1
{-# LANGUAGE ForeignFunctionInterface #-}
3
-- Copyright © 2012 Clint Adams
5
-- This program is free software: you can redistribute it and/or
6
-- modify it under the terms of the GNU Lesser General Public
7
-- License as published by the Free Software Foundation, either
8
-- version 3 of the License, or (at your option) any later version.
10
-- This program is distributed in the hope that it will be useful,
11
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
-- Lesser General Public License for more details.
15
-- You should have received a copy of the GNU Lesser General Public
16
-- License along with this program. If not, see
17
-- <http://www.gnu.org/licenses/>.
19
#include <bindings.dsl.h>
20
#include <sane/sane.h>
22
module Bindings.SANE where
25
#num SANE_CURRENT_MAJOR
26
#num SANE_CURRENT_MINOR
28
#cinline SANE_VERSION_CODE , <SANE_Int> -> <SANE_Int> -> <SANE_Int> -> <SANE_Int>
30
#cinline SANE_VERSION_MAJOR , <SANE_Int> -> <SANE_Int>
31
#cinline SANE_VERSION_MINOR , <SANE_Int> -> <SANE_Int>
32
#cinline SANE_VERSION_BUILD , <SANE_Int> -> <SANE_Int>
41
#synonym_t SANE_Char , CChar
42
#synonym_t SANE_String , CString
43
#synonym_t SANE_String_Const , CString
44
#synonym_t SANE_Handle, Ptr ()
45
#integral_t SANE_Fixed
47
#num SANE_FIXED_SCALE_SHIFT
48
#cinline SANE_FIX , CDouble -> <SANE_Fixed>
49
#cinline SANE_UNFIX , <SANE_Fixed> -> CDouble
51
#integral_t SANE_Status
53
#num SANE_STATUS_UNSUPPORTED
54
#num SANE_STATUS_CANCELLED
55
#num SANE_STATUS_DEVICE_BUSY
56
#num SANE_STATUS_INVAL
58
#num SANE_STATUS_JAMMED
59
#num SANE_STATUS_NO_DOCS
60
#num SANE_STATUS_COVER_OPEN
61
#num SANE_STATUS_IO_ERROR
62
#num SANE_STATUS_NO_MEM
63
#num SANE_STATUS_ACCESS_DENIED
65
#integral_t SANE_Value_Type
79
#num SANE_UNIT_PERCENT
80
#num SANE_UNIT_MICROSECOND
82
#starttype SANE_Device
83
#field name , <SANE_String_Const>
84
#field vendor , <SANE_String_Const>
85
#field model , <SANE_String_Const>
86
#field type , <SANE_String_Const>
89
#num SANE_CAP_SOFT_SELECT
90
#num SANE_CAP_HARD_SELECT
91
#num SANE_CAP_SOFT_DETECT
92
#num SANE_CAP_EMULATED
93
#num SANE_CAP_AUTOMATIC
94
#num SANE_CAP_INACTIVE
95
#num SANE_CAP_ADVANCED
97
#cinline SANE_OPTION_IS_ACTIVE , CInt -> CInt
98
#cinline SANE_OPTION_IS_SETTABLE , CInt -> CInt
100
#num SANE_INFO_INEXACT
101
#num SANE_INFO_RELOAD_OPTIONS
102
#num SANE_INFO_RELOAD_PARAMS
104
#integral_t SANE_Constraint_Type
105
#num SANE_CONSTRAINT_NONE
106
#num SANE_CONSTRAINT_RANGE
107
#num SANE_CONSTRAINT_WORD_LIST
108
#num SANE_CONSTRAINT_STRING_LIST
110
#starttype SANE_Range
111
#field min , <SANE_Word>
112
#field max , <SANE_Word>
113
#field quant , <SANE_Word>
116
#starttype SANE_Option_Descriptor
117
#field name , <SANE_String_Const>
118
#field title , <SANE_String_Const>
119
#field desc , <SANE_String_Const>
120
#field type , <SANE_Value_Type>
121
#field unit , <SANE_Unit>
122
#field size , <SANE_Int>
123
#field cap , <SANE_Int>
124
#field constraint_type , <SANE_Constraint_Type>
125
#union_field constraint.string_list , Ptr <SANE_String_Const>
126
#union_field constraint.word_list , Ptr <SANE_Word>
127
#union_field constraint.range , Ptr <SANE_Range>
130
#integral_t SANE_Action
131
#num SANE_ACTION_GET_VALUE
132
#num SANE_ACTION_SET_VALUE
133
#num SANE_ACTION_SET_AUTO
135
#integral_t SANE_Frame
139
#num SANE_FRAME_GREEN
142
#starttype SANE_Parameters
143
#field format , <SANE_Frame>
144
#field last_frame , <SANE_Bool>
145
#field bytes_per_line , <SANE_Int>
146
#field pixels_per_line , <SANE_Int>
147
#field lines , <SANE_Int>
148
#field depth , <SANE_Int>
151
#opaque_t struct SANE_Auth_Data
153
#num SANE_MAX_USERNAME_LEN
154
#num SANE_MAX_PASSWORD_LEN
156
#callback SANE_Auth_Callback , <SANE_String_Const> -> Ptr <SANE_Char> -> Ptr <SANE_Char> -> IO ()
158
#ccall sane_init , Ptr <SANE_Int> -> <SANE_Auth_Callback> -> IO <SANE_Status>
159
#ccall sane_exit , IO ()
160
#ccall sane_get_devices , Ptr (Ptr (Ptr <SANE_Device>)) -> <SANE_Bool> -> IO <SANE_Status>
161
#ccall sane_open , <SANE_String_Const> -> Ptr <SANE_Handle> -> IO <SANE_Status>
162
#ccall sane_close , <SANE_Handle> -> IO ()
163
#ccall sane_get_option_descriptor , <SANE_Handle> -> <SANE_Int> -> IO (Ptr <SANE_Option_Descriptor>)
164
#ccall sane_control_option , <SANE_Handle> -> <SANE_Int> -> <SANE_Action> -> Ptr () -> Ptr <SANE_Int> -> IO <SANE_Status>
165
#ccall sane_get_parameters , <SANE_Handle> -> Ptr <SANE_Parameters> -> IO <SANE_Status>
166
#ccall sane_start , <SANE_Handle> -> IO <SANE_Status>
167
#ccall sane_read , <SANE_Handle> -> Ptr <SANE_Byte> -> <SANE_Int> -> Ptr <SANE_Int> -> IO <SANE_Status>
168
#ccall sane_cancel , <SANE_Handle> -> IO ()
169
#ccall sane_set_io_mode , <SANE_Handle> -> <SANE_Bool> -> IO <SANE_Status>
170
#ccall sane_get_select_fd , <SANE_Handle> -> Ptr <SANE_Int> -> IO <SANE_Status>
171
#ccall sane_strstatus , <SANE_Status> -> IO <SANE_String_Const>