bindings-libcddb (empty) → 0.3
raw patch · 13 files changed
Files
- LICENSE +29/−0
- Setup.hs +6/−0
- bindings-libcddb.cabal +33/−0
- src/Bindings/Libcddb.hs +1/−0
- src/Bindings/Libcddb/Cddb.hsc +18/−0
- src/Bindings/Libcddb/CddbCmd.hsc +19/−0
- src/Bindings/Libcddb/CddbConn.hsc +86/−0
- src/Bindings/Libcddb/CddbDisc.hsc +70/−0
- src/Bindings/Libcddb/CddbError.hsc +36/−0
- src/Bindings/Libcddb/CddbLog.hsc +22/−0
- src/Bindings/Libcddb/CddbSite.hsc +46/−0
- src/Bindings/Libcddb/CddbTrack.hsc +30/−0
- src/inlines.c +5/−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 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,6 @@+#!/usr/bin/env runhaskell++module Main (main) where+import Distribution.Simple++main = defaultMain
+ bindings-libcddb.cabal view
@@ -0,0 +1,33 @@+cabal-version: >= 1.2.3+name: bindings-libcddb+homepage: http://bitbucket.org/mauricio/bindings-libcddb+synopsis:+ Low level binding to libcddb.+version: 0.3+license: BSD3+license-file: LICENSE+maintainer: Maurício C. Antunes <mauricio.antunes@gmail.com>+author: Maurício C. Antunes+build-type: Simple+bug-reports: http://bitbucket.org/mauricio/bindings-dsl/issues+category: FFI+library+ hs-source-dirs: src+ extensions:+ ForeignFunctionInterface+ build-depends:+ base >=3 && <5,+ bindings-DSL >= 1.0 && < 1.1+ exposed-modules:+ Bindings.Libcddb+ Bindings.Libcddb.Cddb+ Bindings.Libcddb.CddbCmd+ Bindings.Libcddb.CddbConn+ Bindings.Libcddb.CddbDisc+ Bindings.Libcddb.CddbError+ Bindings.Libcddb.CddbLog+ Bindings.Libcddb.CddbSite+ Bindings.Libcddb.CddbTrack+ pkgconfig-depends:+ libcddb >= 1.3.2+ c-sources: src/inlines.c
+ src/Bindings/Libcddb.hs view
@@ -0,0 +1,1 @@+module Bindings.Libcddb (module Bindings.Libcddb.CddbCmd,module Bindings.Libcddb.CddbConn,module Bindings.Libcddb.CddbDisc,module Bindings.Libcddb.CddbError,module Bindings.Libcddb.Cddb,module Bindings.Libcddb.CddbLog,module Bindings.Libcddb.CddbSite,module Bindings.Libcddb.CddbTrack) where {import Bindings.Libcddb.CddbCmd;import Bindings.Libcddb.CddbConn;import Bindings.Libcddb.CddbDisc;import Bindings.Libcddb.CddbError;import Bindings.Libcddb.Cddb;import Bindings.Libcddb.CddbLog;import Bindings.Libcddb.CddbSite;import Bindings.Libcddb.CddbTrack}
+ src/Bindings/Libcddb/Cddb.hsc view
@@ -0,0 +1,18 @@+#include <cddb/cddb.h>+#include <bindings.dsl.h>++-- | <http://libcddb.sourceforge.net/API/cddb_8h.html>++module Bindings.Libcddb.Cddb where+#strict_import++-- integral_t enum cddb_flag_t++-- num CDDB_F_EMPTY_STR+-- num CDDB_F_NO_TRACK_ARTIST++#ccall libcddb_init , IO ()+#ccall libcddb_shutdown , IO ()+-- ccall libcddb_set_flags , CUInt -> IO ()+-- ccall libcddb_reset_flags , CUInt -> IO ()+
+ src/Bindings/Libcddb/CddbCmd.hsc view
@@ -0,0 +1,19 @@+#include <cddb/cddb.h>+#include <bindings.dsl.h>++-- | <http://libcddb.sourceforge.net/API/cddb__cmd_8h.html>++module Bindings.Libcddb.CddbCmd where+#strict_import+import Bindings.Libcddb.CddbConn+import Bindings.Libcddb.CddbDisc++#ccall cddb_read , Ptr <cddb_conn_t> -> Ptr <cddb_disc_t> -> IO CInt+#ccall cddb_query , Ptr <cddb_conn_t> -> Ptr <cddb_disc_t> -> IO CInt+#ccall cddb_query_next , Ptr <cddb_conn_t> -> Ptr <cddb_disc_t> -> IO CInt+#ccall cddb_search , Ptr <cddb_conn_t> -> Ptr <cddb_disc_t> -> CString -> IO CInt+#ccall cddb_search_next , Ptr <cddb_conn_t> -> Ptr <cddb_disc_t> -> IO CInt+-- ccall cddb_album , Ptr <cddb_conn_t> -> Ptr <cddb_disc_t> -> IO CInt+-- ccall cddb_album_next , Ptr <cddb_conn_t> -> Ptr <cddb_disc_t> -> IO CInt+#ccall cddb_write , Ptr <cddb_conn_t> -> Ptr <cddb_disc_t> -> IO CInt+#ccall cddb_sites , Ptr <cddb_conn_t> -> IO CInt
+ src/Bindings/Libcddb/CddbConn.hsc view
@@ -0,0 +1,86 @@+#include <cddb/cddb.h>+#include <bindings.dsl.h>++-- | <http://libcddb.sourceforge.net/API/cddb__conn_8h.html>++module Bindings.Libcddb.CddbConn where+#strict_import+import Bindings.Libcddb.CddbDisc+import Bindings.Libcddb.CddbError+import Bindings.Libcddb.CddbSite++#cinline SEARCHCAT , <cddb_cat_t> -> <cddb_cat_t>++#integral_t cddb_iconv_t+#opaque_t cddb_conn_t++#integral_t cddb_cache_mode_t++#num CACHE_OFF+#num CACHE_ON+#num CACHE_ONLY++#integral_t cddb_search_t++#num SEARCH_NONE+#num SEARCH_ARTIST+#num SEARCH_TITLE+#num SEARCH_TRACK+#num SEARCH_OTHER+#num SEARCH_ALL++#ccall cddb_new , IO (Ptr <cddb_conn_t>)+#ccall cddb_destroy , Ptr <cddb_conn_t> -> IO ()+#ccall cddb_set_charset , Ptr <cddb_conn_t> -> CString -> IO CInt+#ccall cddb_set_buf_size , Ptr <cddb_conn_t> -> CUInt -> IO ()+#ccall cddb_set_site , Ptr <cddb_conn_t> -> \+ Ptr <cddb_site_t> -> IO <cddb_error_t>+#ccall cddb_get_server_name , Ptr <cddb_conn_t> -> IO CString+#ccall cddb_set_server_name , Ptr <cddb_conn_t> -> CString -> IO ()+#ccall cddb_get_server_port , Ptr <cddb_conn_t> -> IO CUInt+#ccall cddb_set_server_port , Ptr <cddb_conn_t> -> CInt -> IO ()+#ccall cddb_get_timeout , Ptr <cddb_conn_t> -> IO CUInt+#ccall cddb_set_timeout , Ptr <cddb_conn_t> -> CUInt -> IO ()+#ccall cddb_get_http_path_query , Ptr <cddb_conn_t> -> IO CString+#ccall cddb_set_http_path_query , Ptr <cddb_conn_t> -> \+ CString -> IO ()+#ccall cddb_get_http_path_submit , Ptr <cddb_conn_t> -> IO CString+#ccall cddb_set_http_path_submit , Ptr <cddb_conn_t> -> \+ CString -> IO ()+#ccall cddb_is_http_enabled , Ptr <cddb_conn_t> -> IO CUInt+#ccall cddb_http_enable , Ptr <cddb_conn_t> -> IO ()+#ccall cddb_http_disable , Ptr <cddb_conn_t> -> IO ()+#ccall cddb_is_http_proxy_enabled , Ptr <cddb_conn_t> -> IO CUInt+#ccall cddb_http_proxy_enable , Ptr <cddb_conn_t> -> IO ()+#ccall cddb_http_proxy_disable , Ptr <cddb_conn_t> -> IO ()+#ccall cddb_get_http_proxy_server_name , Ptr <cddb_conn_t> -> \+ IO CString+#ccall cddb_set_http_proxy_server_name , Ptr <cddb_conn_t> -> \+ CString -> IO ()+#ccall cddb_get_http_proxy_server_port , Ptr <cddb_conn_t> -> IO CUInt+#ccall cddb_set_http_proxy_server_port , Ptr <cddb_conn_t> -> \+ CInt -> IO ()+#ccall cddb_set_http_proxy_username , Ptr <cddb_conn_t> -> \+ CString -> IO ()+#ccall cddb_get_http_proxy_username , Ptr <cddb_conn_t> -> IO CString+#ccall cddb_set_http_proxy_password , Ptr <cddb_conn_t> -> \+ CString -> IO ()+#ccall cddb_get_http_proxy_password , Ptr <cddb_conn_t> -> IO CString+#ccall cddb_set_http_proxy_credentials , Ptr <cddb_conn_t> -> \+ CString -> CString -> IO ()+#ccall cddb_errno , Ptr <cddb_conn_t> -> IO <cddb_error_t>+#ccall cddb_set_client , Ptr <cddb_conn_t> -> CString -> \+ CString -> IO ()+#ccall cddb_set_email_address , Ptr <cddb_conn_t> -> \+ CString -> IO CInt+#ccall cddb_cache_mode , Ptr <cddb_conn_t> -> IO <cddb_cache_mode_t>+#ccall cddb_cache_enable , Ptr <cddb_conn_t> -> IO ()+#ccall cddb_cache_only , Ptr <cddb_conn_t> -> IO ()+#ccall cddb_cache_disable , Ptr <cddb_conn_t> -> IO ()+#ccall cddb_cache_get_dir , Ptr <cddb_conn_t> -> IO CString+#ccall cddb_cache_set_dir , Ptr <cddb_conn_t> -> CString -> IO CInt+#ccall cddb_first_site , Ptr <cddb_conn_t> -> IO (Ptr <cddb_site_t>)+#ccall cddb_next_site , Ptr <cddb_conn_t> -> IO (Ptr <cddb_site_t>)+#ccall cddb_search_set_fields , Ptr <cddb_conn_t> -> CUInt -> IO ()+#ccall cddb_search_set_categories , Ptr <cddb_conn_t> -> \+ CUInt -> IO ()
+ src/Bindings/Libcddb/CddbDisc.hsc view
@@ -0,0 +1,70 @@+#include <cddb/cddb.h>+#include <bindings.dsl.h>++-- | <http://libcddb.sourceforge.net/API/cddb__disc_8h.html>++module Bindings.Libcddb.CddbDisc where+#strict_import+import Bindings.Libcddb.CddbTrack++#num FRAMES_PER_SECOND++#opaque_t cddb_disc_t++#integral_t cddb_cat_t+ +#num CDDB_CAT_DATA+#num CDDB_CAT_FOLK+#num CDDB_CAT_JAZZ+#num CDDB_CAT_MISC+#num CDDB_CAT_ROCK+#num CDDB_CAT_COUNTRY+#num CDDB_CAT_BLUES+#num CDDB_CAT_NEWAGE+#num CDDB_CAT_REGGAE+#num CDDB_CAT_CLASSICAL+#num CDDB_CAT_SOUNDTRACK+#num CDDB_CAT_INVALID+#num CDDB_CAT_LAST++#ccall cddb_disc_new , IO (Ptr <cddb_disc_t>)+#ccall cddb_disc_destroy , Ptr <cddb_disc_t> -> IO ()+#ccall cddb_disc_clone , Ptr <cddb_disc_t> -> IO (Ptr <cddb_disc_t>)+#ccall cddb_disc_add_track , Ptr <cddb_disc_t> -> \+ Ptr <cddb_track_t> -> IO ()+#ccall cddb_disc_get_track , Ptr <cddb_disc_t> -> \+ CInt -> IO (Ptr <cddb_track_t>)+#ccall cddb_disc_get_track_first , Ptr <cddb_disc_t> -> \+ IO (Ptr <cddb_track_t>)+#ccall cddb_disc_get_track_next , Ptr <cddb_disc_t> -> \+ IO (Ptr <cddb_track_t>)+#ccall cddb_disc_get_discid , Ptr <cddb_disc_t> -> IO CUInt+#ccall cddb_disc_set_discid , Ptr <cddb_disc_t> -> CUInt -> IO ()+#ccall cddb_disc_get_category , Ptr <cddb_disc_t> -> IO <cddb_cat_t>+#ccall cddb_disc_set_category , Ptr <cddb_disc_t> -> \+ <cddb_cat_t> -> IO ()+#ccall cddb_disc_get_category_str , Ptr <cddb_disc_t> -> IO CString+#ccall cddb_disc_set_category_str , Ptr <cddb_disc_t> -> \+ CString -> IO ()+#ccall cddb_disc_get_genre , Ptr <cddb_disc_t> -> IO CString+#ccall cddb_disc_set_genre , Ptr <cddb_disc_t> -> CString -> IO ()+#ccall cddb_disc_get_length , Ptr <cddb_disc_t> -> IO CUInt+#ccall cddb_disc_set_length , Ptr <cddb_disc_t> -> CUInt -> IO ()+#ccall cddb_disc_get_year , Ptr <cddb_disc_t> -> IO CUInt+#ccall cddb_disc_set_year , Ptr <cddb_disc_t> -> CUInt -> IO ()+#ccall cddb_disc_get_track_count , Ptr <cddb_disc_t> -> IO CInt+#ccall cddb_disc_get_title , Ptr <cddb_disc_t> -> IO CString+#ccall cddb_disc_set_title , Ptr <cddb_disc_t> -> CString -> IO ()+#ccall cddb_disc_append_title , Ptr <cddb_disc_t> -> CString -> IO ()+#ccall cddb_disc_get_artist , Ptr <cddb_disc_t> -> IO CString+#ccall cddb_disc_set_artist , Ptr <cddb_disc_t> -> CString -> IO ()+#ccall cddb_disc_append_artist , Ptr <cddb_disc_t> -> CString -> IO ()+#ccall cddb_disc_get_ext_data , Ptr <cddb_disc_t> -> IO CString+#ccall cddb_disc_set_ext_data , Ptr <cddb_disc_t> -> CString -> IO ()+#ccall cddb_disc_append_ext_data , Ptr <cddb_disc_t> -> CString -> IO ()+#ccall cddb_disc_copy , Ptr <cddb_disc_t> -> Ptr <cddb_disc_t> -> IO ()+#ccall cddb_disc_calc_discid , Ptr <cddb_disc_t> -> IO CInt+#ccall cddb_disc_print , Ptr <cddb_disc_t> -> IO ()++#globalarray CDDB_CATEGORY , CString+
+ src/Bindings/Libcddb/CddbError.hsc view
@@ -0,0 +1,36 @@+#include <cddb/cddb.h>+#include <bindings.dsl.h>++-- | <http://libcddb.sourceforge.net/API/cddb__error_8h.html>++module Bindings.Libcddb.CddbError where+#strict_import++#integral_t cddb_error_t++#num CDDB_ERR_OK+#num CDDB_ERR_OUT_OF_MEMORY+#num CDDB_ERR_LINE_SIZE+#num CDDB_ERR_NOT_IMPLEMENTED+#num CDDB_ERR_UNKNOWN+#num CDDB_ERR_SERVER_ERROR+#num CDDB_ERR_UNKNOWN_HOST_NAME+#num CDDB_ERR_CONNECT+#num CDDB_ERR_PERMISSION_DENIED+#num CDDB_ERR_NOT_CONNECTED+#num CDDB_ERR_UNEXPECTED_EOF+#num CDDB_ERR_INVALID_RESPONSE+#num CDDB_ERR_DISC_NOT_FOUND+#num CDDB_ERR_DATA_MISSING+#num CDDB_ERR_TRACK_NOT_FOUND+#num CDDB_ERR_REJECTED+#num CDDB_ERR_EMAIL_INVALID+#num CDDB_ERR_INVALID_CHARSET+#num CDDB_ERR_ICONV_FAIL+#num CDDB_ERR_PROXY_AUTH+#num CDDB_ERR_INVALID+#num CDDB_ERR_LAST++#ccall cddb_error_str , <cddb_error_t> -> IO CString+#ccall cddb_error_stream_print , Ptr CFile -> <cddb_error_t> -> IO ()+#ccall cddb_error_print , <cddb_error_t> -> IO ()
+ src/Bindings/Libcddb/CddbLog.hsc view
@@ -0,0 +1,22 @@+#include <cddb/cddb.h>+#include <bindings.dsl.h>++-- | <http://libcddb.sourceforge.net/API/cddb__log_8h.html>++module Bindings.Libcddb.CddbLog where+#strict_import++#callback cddb_log_handler_t , <cddb_log_level_t> -> CString -> IO ()++#integral_t cddb_log_level_t++#num CDDB_LOG_DEBUG+#num CDDB_LOG_INFO+#num CDDB_LOG_WARN+#num CDDB_LOG_ERROR+#num CDDB_LOG_CRITICAL+#num CDDB_LOG_NONE++#ccall cddb_log_set_handler , <cddb_log_handler_t> -> \+ IO <cddb_log_handler_t>+#ccall cddb_log_set_level , <cddb_log_level_t> -> IO ()
+ src/Bindings/Libcddb/CddbSite.hsc view
@@ -0,0 +1,46 @@+#include <cddb/cddb.h>+#include <bindings.dsl.h>++-- | <http://libcddb.sourceforge.net/API/cddb__site_8h.html>++module Bindings.Libcddb.CddbSite where+#strict_import+import Bindings.Libcddb.CddbError++#opaque_t cddb_site_t++#integral_t cddb_protocol_t++#num PROTO_UNKNOWN+#num PROTO_CDDBP+#num PROTO_HTTP++#ccall cddb_site_new , IO (Ptr <cddb_site_t>)+#ccall cddb_site_destroy , Ptr <cddb_site_t> -> IO <cddb_error_t>+#ccall cddb_site_clone , Ptr <cddb_site_t> -> IO (Ptr <cddb_site_t>)+#ccall cddb_site_get_address , Ptr <cddb_site_t> -> \+ Ptr CString -> Ptr CUInt -> IO <cddb_error_t>+#ccall cddb_site_set_address , Ptr <cddb_site_t> -> CString -> \+ CUInt -> IO <cddb_error_t>+#ccall cddb_site_get_protocol , Ptr <cddb_site_t> -> \+ IO <cddb_protocol_t>+#ccall cddb_site_set_protocol , Ptr <cddb_site_t> -> \+ <cddb_protocol_t> -> IO <cddb_error_t>+#ccall cddb_site_get_query_path , Ptr <cddb_site_t> -> \+ Ptr CString -> IO <cddb_error_t>+#ccall cddb_site_set_query_path , Ptr <cddb_site_t> -> \+ CString -> IO <cddb_error_t>+#ccall cddb_site_get_submit_path , Ptr <cddb_site_t> -> \+ Ptr CString -> IO <cddb_error_t>+#ccall cddb_site_set_submit_path , Ptr <cddb_site_t> -> \+ CString -> IO <cddb_error_t>+#ccall cddb_site_get_location , Ptr <cddb_site_t> -> Ptr CFloat -> \+ Ptr CFloat -> IO <cddb_error_t>+#ccall cddb_site_set_location , Ptr <cddb_site_t> -> CFloat -> \+ CFloat -> IO <cddb_error_t>+#ccall cddb_site_get_description , Ptr <cddb_site_t> -> \+ Ptr CString -> IO <cddb_error_t>+#ccall cddb_site_set_description , Ptr <cddb_site_t> -> \+ CString -> IO <cddb_error_t>+#ccall cddb_site_parse , Ptr <cddb_site_t> -> CString -> IO CInt+#ccall cddb_site_print , Ptr <cddb_site_t> -> IO <cddb_error_t>
+ src/Bindings/Libcddb/CddbTrack.hsc view
@@ -0,0 +1,30 @@+#include <cddb/cddb.h>+#include <bindings.dsl.h>++-- | <http://libcddb.sourceforge.net/API/cddb__track_8h.html>++module Bindings.Libcddb.CddbTrack where+#strict_import++#opaque_t cddb_track_t++#ccall cddb_track_new , IO (Ptr <cddb_track_t>)+#ccall cddb_track_destroy , Ptr <cddb_track_t> -> IO ()+#ccall cddb_track_clone , Ptr <cddb_track_t> -> IO (Ptr <cddb_track_t>)+#ccall cddb_track_get_number , Ptr <cddb_track_t> -> IO CInt+#ccall cddb_track_get_frame_offset , Ptr <cddb_track_t> -> IO CInt+#ccall cddb_track_set_frame_offset , Ptr <cddb_track_t> -> CInt -> IO ()+#ccall cddb_track_get_length , Ptr <cddb_track_t> -> IO CInt+#ccall cddb_track_set_length , Ptr <cddb_track_t> -> CInt -> IO ()+#ccall cddb_track_get_title , Ptr <cddb_track_t> -> IO CString+#ccall cddb_track_set_title , Ptr <cddb_track_t> -> CString -> IO ()+#ccall cddb_track_append_title , Ptr <cddb_track_t> -> CString -> IO ()+#ccall cddb_track_get_artist , Ptr <cddb_track_t> -> IO CString+#ccall cddb_track_set_artist , Ptr <cddb_track_t> -> CString -> IO ()+#ccall cddb_track_append_artist , Ptr <cddb_track_t> -> CString -> IO ()+#ccall cddb_track_get_ext_data , Ptr <cddb_track_t> -> IO CString+#ccall cddb_track_set_ext_data , Ptr <cddb_track_t> -> CString -> IO ()+#ccall cddb_track_append_ext_data , Ptr <cddb_track_t> -> CString -> IO ()+#ccall cddb_track_copy , Ptr <cddb_track_t> -> Ptr <cddb_track_t> -> IO ()+#ccall cddb_track_print , Ptr <cddb_track_t> -> IO ()+
+ src/inlines.c view
@@ -0,0 +1,5 @@+#include <bindings.cmacros.h>+#include <cddb/cddb.h>++BC_INLINE1(SEARCHCAT,cddb_cat_t,cddb_cat_t)+BC_GLOBALARRAY(CDDB_CATEGORY,char*)