Fixed some bugs in doxygen documentation. Added some comments.

merge-requests/1/head
Henning Geinitz 2005-10-03 18:18:02 +00:00
rodzic 324ca7690d
commit 64e53087da
6 zmienionych plików z 176 dodań i 82 usunięć

Wyświetl plik

@ -21,6 +21,10 @@
website).
* doc/doxygen-sanei.conf.in: Updated to current doxygen
version. Output more C-friendly format.
* include/sane/sanei.h include/sane/sanei_backend.h
include/sane/sanei_debug.h include/sane/sanei_pp.h
include/sane/sanei_usb.h: Fixed some bugs in doxygen
documentation. Added some comments.
2005-10-02 Gerhard Jaeger <gerhard@gjaeger.de>

Wyświetl plik

@ -49,7 +49,7 @@
/** @mainpage SANEI (SANE internal routines) documentation
*
* @image html ../images/sane-logo2.jpg
* @image html sane-logo2.jpg
* @section intro Introduction
*
* The header files in the include/sane/ directory named sanei_*.h provide
@ -70,7 +70,7 @@
* - Information on how to write a backend: <a
* href="../backend-writing.txt">backend-writing.txt</a>.
* - General SANE documentation is on <a
* href="http://www.sane-project.org/docs.html>the SANE documentation
* href="http://www.sane-project.org/docs.html">the SANE documentation
* page</a>.
*
* @section contact Contact
@ -135,17 +135,6 @@
/* @} */
/** @name Private macros
* @{
*/
/** @def STRINGIFY1(x)
* Internal use only.
*/
/** @def PASTE1(x,y)
* Internal use only.
*/
/* @} */
/* A few convenience macros: */
/** @hideinitializer */
#define NELEMS(a) ((int)(sizeof (a) / sizeof (a[0])))

Wyświetl plik

@ -8,26 +8,24 @@
* @sa sanei.h sanei_thread.h
*/
/** @name Compatibility macros
* @{
*/
/*
* Compiler related options
*/
/** Mark unused variables/parameters
*
* Tells the compiler a variable is unused, so the compiler doesn't spit a warning.
*/
#ifdef __GNUC__
/* __unused tells the compiler a variable is unused, so the
* compiler doesn't spit a warning. */
#define __sane_unused__ __attribute__((unused))
#else
#define __sane_unused__
#endif
/** @name Compatibility macros
* @{
*/
#include <sane/sanei_debug.h>
#ifdef HAVE_SYS_HW_H
@ -145,29 +143,27 @@ extern void ENTRY(exit) (void);
#endif /* STUBS */
/* @} */
/** @name Internationalization for SANE backends
/** Internationalization for SANE backends
*
* Add SANE_I18N() to all texts that can be translated.
* E.g. out_txt = SANE_I18N("Hello");
* @{
* E.g. out_txt = SANE_I18N("Hello");
*/
#ifndef SANE_I18N
#define SANE_I18N(text) text
#endif
/* @} */
/** @name Option_Value union
* convenience union to access option values given to the backend
* @{
/** Option_Value union
*
* Convenience union to access option values given to the backend
*/
#ifndef SANE_OPTION
#define SANE_OPTION 1
typedef union
{
SANE_Bool b;
SANE_Word w;
SANE_Word *wa; /* word array */
SANE_String s;
SANE_Bool b; /**< bool */
SANE_Word w; /**< word */
SANE_Word *wa; /**< word array */
SANE_String s; /**< string */
}
Option_Value;
#define SANE_OPTION 1
#endif
/* @} */

Wyświetl plik

@ -1,51 +1,153 @@
/** @file sanei_debug.h
* Support for printing debug messages.
*
* Use the functions of this header file to print debug or warning messages.
*/
#ifndef _SANEI_DEBUG_H
#define _SANEI_DEBUG_H
#include <sane/sanei.h>
#define ENTRY(name) PASTE(PASTE(PASTE(sane_,BACKEND_NAME),_),name)
/** @name Public macros
* These macros can be used in backends and other SANE-related
* code.
*
* Before including sanei_debug.h, the following macros must be set:
*
* - BACKEND_NAME - The name of your backend without double-quotes (must be set in any case)
* - STUBS - If this is defined, no macros will be included. Used in
* backends consisting of more than one .c file.
* - DEBUG_DECLARE_ONLY - Generates prototypes instead of functions. Used in
* backends consisting of more than one .c file.
* - DEBUG_NOT_STATIC - Doesn't generate static functions. Used in header files if
* they are include in more than one .c file.
*
* @{
*/
/* The cpp that comes with GNU C 2.5 seems to have troubles understanding
vararg macros. */
#if __GNUC__ - 0 > 2 || (__GNUC__ - 0 == 2 && __GNUC_MINOR__ > 5)
# define HAVE_VARARG_MACROS
#endif
/** @def DBG_INIT()
* Initialize sanei_debug.
*
* Call this function before you use any DBG function.
*/
#ifndef HAVE_VARARG_MACROS
extern void sanei_debug (int level, const char *msg, ...);
#endif
/** @def DBG(level, fmt, ...)
* Print a message at debug level `level' or higher using a printf-like
* function. Example: DBG(1, "sane_open: opening fd \%d\\n", fd).
*
* @param level debug level
* @param fmt format (see man 3 printf for details)
* @param ... additional arguments
*/
/** @def IF_DBG(x)
* Compile code only if debugging is enabled.
*
* Expands to x if debug support is enabled at compile-time. If NDEBUG is
* defined at compile-time this macro expands to nothing.
*
* @param x code to expand when debugging is enabled
*/
/**
* @def DBG_LEVEL
* Current debug level.
*
* You can only read this "variable".
*/
/** @def ENTRY(name)
* Expands to sane_BACKEND_NAME_name.
*
* Example: ENTRY(init) in mustek.c will expand to sane_mustek_init.
*/
/* @} */
/** @hideinitializer*/
#define ENTRY(name) PASTE(PASTE(PASTE(sane_,BACKEND_NAME),_),name)
#ifdef NDEBUG
# define DBG_INIT(backend, var)
# ifdef HAVE_VARARG_MACROS
# define DBG(level, msg, args...)
# else
# define DBG if (0) sanei_debug
# endif
# define IF_DBG(x)
#else
# include <stdio.h>
extern void sanei_debug_ndebug (int level, const char *msg, ...);
# define DBG_LEVEL (0)
# define DBG_INIT()
# define DBG sanei_debug_ndebug
# define IF_DBG(x)
#else /* !NDEBUG */
/** @hideinitializer*/
# define DBG_LEVEL PASTE(sanei_debug_,BACKEND_NAME)
#define DBG_LEVEL PASTE(sanei_debug_,BACKEND_NAME)
# if defined(BACKEND_NAME) && !defined(STUBS)
# ifdef DEBUG_DECLARE_ONLY
extern int DBG_LEVEL;
# else /* !DEBUG_DECLARE_ONLY */
int DBG_LEVEL = 0;
# endif /* DEBUG_DECLARE_ONLY */
# endif /* BACKEND_NAME && !STUBS */
#if defined(BACKEND_NAME) && !defined(STUBS)
int PASTE(sanei_debug_,BACKEND_NAME);
/** @hideinitializer*/
# define DBG_INIT() \
sanei_init_debug (STRINGIFY(BACKEND_NAME), &DBG_LEVEL)
/** @hideinitializer*/
# define DBG_LOCAL PASTE(DBG_LEVEL,_call)
# ifndef STUBS
# ifdef DEBUG_DECLARE_ONLY
extern void DBG_LOCAL (int level, const char *msg, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)))
#endif
;
# define DBG_INIT() \
sanei_init_debug (STRINGIFY(BACKEND_NAME), \
&PASTE(sanei_debug_,BACKEND_NAME))
# else /* !DEBUG_DECLARE_ONLY */
/* The cpp that comes with GNU C 2.5 seems to have troubles understanding
vararg macros. */
#ifdef HAVE_VARARG_MACROS
# define DBG(level, msg, args...) \
do { \
if (DBG_LEVEL >= (level)) \
fprintf (stderr, "[" STRINGIFY(BACKEND_NAME) "] " msg, ##args); \
} while (0)
# include <stdarg.h>
extern void sanei_debug_msg
(int level, int max_level, const char *be, const char *fmt, va_list ap);
extern void sanei_init_debug (const char * backend, int * debug_level_var);
#else
# define DBG sanei_debug
#endif
#ifdef __GNUC__
# ifndef DEBUG_NOT_STATIC
static
# endif /* !DEBUG_NOT_STATIC */
void DBG_LOCAL (int level, const char *msg, ...) __attribute__ ((format (printf, 2, 3)));
#endif /* __GNUC__ */
# define IF_DBG(x) x
#endif
# ifndef DEBUG_NOT_STATIC
static
# endif /* !DEBUG_NOT_STATIC */
void
DBG_LOCAL (int level, const char *msg, ...)
{
va_list ap;
va_start (ap, msg);
sanei_debug_msg (level, DBG_LEVEL, STRINGIFY(BACKEND_NAME), msg, ap);
va_end (ap);
}
# endif /* DEBUG_DECLARE_ONLY */
# endif /* !STUBS */
/** @hideinitializer*/
# define DBG DBG_LOCAL
extern void sanei_init_debug (const char * backend, int * debug_level_var);
/** @hideinitializer*/
# define IF_DBG(x) x
#endif /* NDEBUG */
#endif /* _SANEI_DEBUG_H */

Wyświetl plik

@ -50,19 +50,19 @@
#include <sys/types.h>
#include <sane/sane.h>
/** some modes, we'd like to see/use... */
/** some modes, we'd like to see/use. */
enum sanei_pp_mode {
SANEI_PP_MODE_SPP = (1<<1),
SANEI_PP_MODE_BIDI = (1<<2),
SANEI_PP_MODE_EPP = (1<<4),
SANEI_PP_MODE_ECP = (1<<8)
SANEI_PP_MODE_SPP = (1<<1), /**< SPP */
SANEI_PP_MODE_BIDI = (1<<2), /**< BIDI */
SANEI_PP_MODE_EPP = (1<<4), /**< EPP */
SANEI_PP_MODE_ECP = (1<<8) /**< ECP */
};
#define SANEI_PP_DATAIN 1
#define SANEI_PP_DATAOUT 0
/** Parallelport Control-Register definitions
*/
/* @{ */
/** Parallelport Control-Register definitions */
#define SANEI_PP_CTRL_STROBE 0x01
#define SANEI_PP_CTRL_AUTOLF 0x02
#define SANEI_PP_CTRL_NOT_INIT 0x04
@ -70,7 +70,7 @@ enum sanei_pp_mode {
#define SANEI_PP_CTRL_ENABLE_IRQ 0x10
#define SANEI_PP_CTRL_DIRECTION 0x20
#define SANEI_PP_CTRL_RESERVED 0xc0
/* @} */
/** Initialize sanei_pp.
*

Wyświetl plik

@ -233,9 +233,12 @@ extern void sanei_usb_close (SANE_Int dn);
*
* @param timeout the new timeout in ms
*/
#define HAVE_SANEI_USB_SET_TIMEOUT
extern void sanei_usb_set_timeout (SANE_Int timeout);
/** Check if sanei_usb_set_timeout() is available.
*/
#define HAVE_SANEI_USB_SET_TIMEOUT
/** Initiate a bulk transfer read.
*
* Read up to size bytes from the device to buffer. After the read, size