1 /* sane - Scanner Access Now Easy.
2 Copyright (C) 1996 David Mosberger-Tang and Andreas Beck
3 Copyright (C) 2002, 2003 Henning Meier-Geinitz
5 This file is part of the SANE package.
7 SANE is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 SANE is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License
18 along with sane; see the file COPYING. If not, write to the Free
19 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 As a special exception, the authors of SANE give permission for
22 additional uses of the libraries contained in this release of SANE.
24 The exception is that, if you link a SANE library with other files
25 to produce an executable, this does not by itself cause the
26 resulting executable to be covered by the GNU General Public
27 License. Your use of that executable is in no way restricted on
28 account of linking the SANE library code into it.
30 This exception does not, however, invalidate any other reasons why
31 the executable file might be covered by the GNU General Public
34 If you submit changes to SANE to the maintainers to be included in
35 a subsequent release, you agree by submitting the changes that
36 those changes may be distributed with this exception intact.
38 If you write modifications of your own for SANE, it is your choice
39 whether to permit this exception to apply to your modifications.
40 If you do not wish that, delete this exception notice.
44 * Convenience macros and function declarations for backends
45 * @sa sanei_backend.h sanei_thread.h
48 /* Doxygen documentation */
50 /** @mainpage SANEI (SANE internal routines) documentation
52 * @image html ../images/sane-logo2.jpg
53 * @section intro Introduction
55 * The header files in the include/sane/ directory named sanei_*.h provide
56 * function declarations and macros that can be used by every SANE backend.
57 * Their implementations can be found in the sanei/ directory. The code aims
58 * to be platform-independent to avoid lots of \#ifdef code in the backends.
59 * Please use the SANEI functions wherever possible.
61 * This documentation was created by the use of doxygen, the
62 * doc/doxygen-sanei.conf configuration file and dcoumentation in the sanei_*.h
65 * This documenation is far from complete. Any help is appreciated.
67 * @section additional Additional documentation
68 * - The SANE standard can be found at <a
69 * href="http://www.sane-project.org/html/">the SANE webserver</a>.
70 * - Information on how to write a backend: <a
71 * href="../backend-writing.txt">backend-writing.txt</a>.
72 * - General SANE documentation is on <a
73 * href="http://www.sane-project.org/docs.html>the SANE documentation
76 * @section contact Contact
78 * The common way to contact the developers of SANE is the sane-devel
79 * mailing list. See the <a
80 * href="http://www.sane-project.org/mailing-lists.html">mailing list webpage</a>
81 * for details. That's the place to ask questions, report bugs, or announce
91 /** @name Public macros and functions
95 * Turn parameter into string.
98 * Concatenate parameters.
102 * Return number of elements of an array.
106 /** @fn extern SANE_Status sanei_check_value (const SANE_Option_Descriptor * opt, void * value);
107 * Check the constraints of a SANE option.
109 * @param opt option to check
110 * @param value value of the option
113 * - SANE_STATUS_GOOD - on success
114 * - SANE_STATUS_INVAL - if the value doesn't fit inside the constraint
115 * or any other error occured
116 * @sa sanei_constrain_value()
119 /** @fn extern SANE_Status sanei_constrain_value (const SANE_Option_Descriptor * opt, void * value, SANE_Word * info);
120 * Check the constraints of a SANE option and adjust its value if necessary.
122 * Depending on the type of the option and constraint, value is modified
123 * to fit inside constraint.
125 * @param opt option to check
126 * @param value value of the option
127 * @param info info is set to SANE_INFO_INEXACT if value was changed
130 * - SANE_STATUS_GOOD - on success
131 * - SANE_STATUS_INVAL - if the function wasn't able to fit value into the
132 * constraint or any other error occured
133 * @sa sanei_check_value()
138 /** @name Private macros
141 /** @def STRINGIFY1(x)
149 /* A few convenience macros: */
150 /** @hideinitializer */
151 #define NELEMS(a) ((int)(sizeof (a) / sizeof (a[0])))
153 /** @hideinitializer */
154 #define STRINGIFY1(x) #x
155 /** @hideinitializer */
156 #define STRINGIFY(x) STRINGIFY1(x)
158 /** @hideinitializer */
159 #define PASTE1(x,y) x##y
160 /** @hideinitializer */
161 #define PASTE(x,y) PASTE1(x,y)
163 extern SANE_Status sanei_check_value (const SANE_Option_Descriptor * opt,
166 extern SANE_Status sanei_constrain_value (const SANE_Option_Descriptor * opt,
167 void * value, SANE_Word * info);