diff --git a/net.tex b/net.tex index 9e6b8bd..1d1f0ea 100644 --- a/net.tex +++ b/net.tex @@ -70,24 +70,24 @@ the most commonly used protocols. The four primitive types of the SANE standard are encoded as follows: \begin{description} -\item[\code{\defn{SANE\_Byte}}:] A byte is encoded as an 8 bit value. +\item[\code{\defn{SANE_Byte}}:] A byte is encoded as an 8 bit value. Since the transport protocol is assumed to be byte-orientd, the bit order is irrelevant. -\item[\code{\defn{SANE\_Word}}:] A word is encoded as 4 bytes (32 +\item[\code{\defn{SANE_Word}}:] A word is encoded as 4 bytes (32 bits). The bytes are ordered from most-significant to least-significant byte (big-endian byte-order). -\item[\code{\defn{SANE\_Char}}:] A character is currently encoded as an 8-bit +\item[\code{\defn{SANE_Char}}:] A character is currently encoded as an 8-bit ISO LATIN-1 value. An extension to support wider character sets (16 or 32 bits) is planned for the future, but not supported at this point. -\item[\code{\defn{SANE\_String}}:] A string pointer is encoded as a - \code{SANE\_Char} array. The trailing NUL byte is considered part +\item[\code{\defn{SANE_String}}:] A string pointer is encoded as a + \code{SANE_Char} array. The trailing NUL byte is considered part of the array and a \code{NULL} pointer is encoded as a zero-length array. -\item[\code{\defn{SANE\_Handle}}:] A handle is encoded like a word. +\item[\code{\defn{SANE_Handle}}:] A handle is encoded like a word. The network backend needs to take care of converting these integer values to the opaque pointer values that are presented to the user of the network backend. Similarly, the SANE daemon needs to take @@ -142,7 +142,7 @@ call (RPC) protocol. This means that all activity is initiated by the client side (the network backend)---a server is restricted to answering request by the client. -\subsection{\code{\defn{SANE\_NET\_INIT}}} +\subsection{\code{\defn{SANE_NET_INIT}}} This RPC establishes a connection to a particular SANE network daemon. It must be the first call in a SANE network session. The parameter @@ -150,11 +150,11 @@ and reply arguments for this call are shown in the table below: \begin{center} \begin{tabular}{ll} {\bf request:} & {\bf reply:} \\ - \code{SANE\_Word version\_code} & \code{SANE\_Word status} \\ - \code{SANE\_String user\_name} & \code{SANE\_Word version\_code} \\ + \code{SANE_Word version_code} & \code{SANE_Word status} \\ + \code{SANE_String user_name} & \code{SANE_Word version_code} \\ \end{tabular} \end{center} -The \code{version\_code} argument in the request is the SANE +The \code{version_code} argument in the request is the SANE version-code of the network backend that is contacting the network daemon (see Section~\ref{sec:saneversioncode}). The ``build-revision'' in the version code is used to hold the network @@ -162,7 +162,7 @@ protocol version. The SANE network daemon receiving such a request must make sure that the network protocol version corresponds to a supported version since otherwise the encoding of the network stream may be incompatible (even though the SANE interface itself may be -compatible). The \code{user\_name} argument is the name of the user +compatible). The \code{user_name} argument is the name of the user on whose behalf this call is being performed. If the network backend cannot determine a user-name, it passes a \code{NULL} pointer for this argument. No trust should be placed in the authenticity of this @@ -171,49 +171,49 @@ to the user. E.g., it could be used as the default-user name in subsequent authentication calls. In the reply, \code{status} indicates the completion status. If the -value is anything other than \code{SANE\_STA\-TUS\_SUCCESS}, the +value is anything other than \code{SANE_STATUS_SUCCESS}, the remainder of the reply has undefined values.\footnote{The sane network daemon should be careful not to leak information in the undefined - portion of the reply.} The \code{version\_code} argument returns the + portion of the reply.} The \code{version_code} argument returns the SANE version-code that the network daemon supports. See the comments in the previous paragraph on the meaning of the build-revision in this version code. -\subsection{\code{\defn{SANE\_NET\_GET\_DEVICES}}} +\subsection{\code{\defn{SANE_NET_GET_DEVICES}}} This RPC is used to obtain the list of devices accessible by the SANE daemon. \begin{center} \begin{tabular}{ll} {\bf request:} & {\bf reply:} \\ - \code{void} & \code{SANE\_Word status} \\ - & \code{SANE\_Device ***device\_list} \\ + \code{void} & \code{SANE_Word status} \\ + & \code{SANE_Device ***device_list} \\ \end{tabular} \end{center} There are no arguments in the request for this call. In the reply, \code{status} indicates the completion status. If the -value is anything other than \code{SANE\_STA\-TUS\_SUCCESS}, the -remainder of the reply has undefined values. The \code{device\_list} +value is anything other than \code{SANE_STATUS_SUCCESS}, the +remainder of the reply has undefined values. The \code{device_list} argument is a pointer to a \code{NULL}-terminated array of -\code{SANE\_Device} pointers. +\code{SANE_Device} pointers. -\subsection{\code{\defn{SANE\_NET\_OPEN}}} +\subsection{\code{\defn{SANE_NET_OPEN}}} This RPC is used to open a connection to a remote SANE device. \begin{center} \begin{tabular}{ll} {\bf request:} & {\bf reply:} \\ - \code{SANE\_String device\_name} & \code{SANE\_Word status} \\ - & \code{SANE\_Word handle} \\ - & \code{SANE\_String resource} \\ + \code{SANE_String device_name} & \code{SANE_Word status} \\ + & \code{SANE_Word handle} \\ + & \code{SANE_String resource} \\ \end{tabular} \end{center} -The \code{device\_name} argument specifies the name of the device to +The \code{device_name} argument specifies the name of the device to open. In the reply, \code{status} indicates the completion status. If the -value is anything other than \code{SANE\_STA\-TUS\_SUCCESS}, the +value is anything other than \code{SANE_STATUS_SUCCESS}, the remainder of the reply has undefined values. The \code{handle} argument specifies the device handle that uniquely identifies the connection. The \code{resource} argument is used to request @@ -222,13 +222,13 @@ backend should authenticate the specified resource and then retry this operation (see Section~\ref{sec:authorization} for details on how to authorize a resource). -\subsection{\code{\defn{SANE\_NET\_CLOSE}}} +\subsection{\code{\defn{SANE_NET_CLOSE}}} This RPC is used to close a connection to a remote SANE device. \begin{center} \begin{tabular}{ll} {\bf request:} & {\bf reply:} \\ - \code{SANE\_Word handle} & \code{SANE\_Word dummy} \\ + \code{SANE_Word handle} & \code{SANE_Word dummy} \\ \end{tabular} \end{center} The \code{handle} argument identifies the connection that should be @@ -238,14 +238,14 @@ In the reply, the \code{dummy} argument is unused. Its purpose is to ensure proper synchronization (without it, a net client would not be able to determine when the RPC has completed). -\subsection{\code{\defn{SANE\_NET\_GET\_OPTION\_DESCRIPTORS}}} +\subsection{\code{\defn{SANE_NET_GET_OPTION_DESCRIPTORS}}} This RPC is used to obtain {\em all\/} the option descriptors for a remote SANE device. \begin{center} \begin{tabular}{ll} {\bf request:} & {\bf reply:} \\ - \code{SANE\_Word handle} & \code{Option\_Descriptor\_Array odesc} \\ + \code{SANE_Word handle} & \code{Option_Descriptor_Array odesc} \\ \end{tabular} \end{center} The \code{handle} argument identifies the remote device whose option @@ -254,7 +254,7 @@ descriptors should be obtained. In the reply, the \code{odesc} argument is used to return the array of option descriptors. The option descriptor array has the following structure: -\begin{quote}\index{Option\_Descriptor\_Array} +\begin{quote}\index{Option_Descriptor_Array} \begin{verbatim} struct Option_Descriptor_Array { @@ -265,33 +265,33 @@ struct Option_Descriptor_Array \end{quote} -\subsection{\code{\defn{SANE\_NET\_CONTROL\_OPTION}}} +\subsection{\code{\defn{SANE_NET_CONTROL_OPTION}}} This RPC is used to control (inquire, set, or set to automatic) a specific option of a remote SANE device. \begin{center} \begin{tabular}{ll} {\bf request:} & {\bf reply:} \\ - \code{SANE\_Word handle} & \code{SANE\_Status status} \\ - \code{SANE\_Word option} & \code{SANE\_Word info} \\ - \code{SANE\_Word action} & \code{SANE\_Word value\_type} \\ - \code{SANE\_Word value\_type} & \code{SANE\_Word value\_size} \\ - \code{SANE\_Word value\_size} & \code{void *value} \\ - \code{void *value} & \code{SANE\_String *resource} \\ + \code{SANE_Word handle} & \code{SANE_Status status} \\ + \code{SANE_Word option} & \code{SANE_Word info} \\ + \code{SANE_Word action} & \code{SANE_Word value_type} \\ + \code{SANE_Word value_type} & \code{SANE_Word value_size} \\ + \code{SANE_Word value_size} & \code{void *value} \\ + \code{void *value} & \code{SANE_String *resource} \\ \end{tabular} \end{center} The \code{handle} argument identifies the remote device whose option should be controlled. Argument \code{option} is the number (index) of the option that should be controlled. Argument \code{action} specifies what action should be taken (get, set, or set automatic). -Argument \code{value\_type} specifies the type of the option value -(must be one of \code{SANE\_TYPE\_BOOL}, \code{SANE\_TYPE\_INT}, -\code{SANE\_TYPE\_FIXED}, \code{SANE\_TYPE\_STR\-ING}, -\code{SANE\_TYPE\_BUTTON}). Argument \code{value\_size} specifies +Argument \code{value_type} specifies the type of the option value +(must be one of \code{SANE_TYPE_BOOL}, \code{SANE_TYPE_INT}, +\code{SANE_TYPE_FIXED}, \code{SANE_TYPE_STRING}, +\code{SANE_TYPE_BUTTON}). Argument \code{value_size} specifies the size of the option value in number of bytes (see Section~\ref{sec:valuesize} for the precise meaning of this value). Finally, argument \code{value} is a pointer to the option value. It -must be a writeable area that is at least \code{value\_size} bytes +must be a writeable area that is at least \code{value_size} bytes large. (Note that this area must be writable even if the action is to set the option value. This is because the backend may not be able to set the exact option value, in which case the option value is used to @@ -303,12 +303,12 @@ this value is non-\code{NULL}, all other arguments have undefined values (see Section~\ref{sec:authorization} for details on how to authorize a resource). Argument \code{status} indicates the completion status. If the value is anything other than -\code{SANE\_STA\-TUS\_SUCCESS}, the remainder of the reply has undefined +\code{SANE_STATUS_SUCCESS}, the remainder of the reply has undefined values. The \code{info} argument returns the information on how well the backend was able to satisfy the request. For details, see the description of the corresponding argument in -Section~\ref{sec:control}. Arguments \code{value\_type} and -\code{value\_size} have the same values as the arguments by the same +Section~\ref{sec:control}. Arguments \code{value_type} and +\code{value_size} have the same values as the arguments by the same name in corresponding request. The values are repeated here to ensure that both the request and the reply are self-contained (i.e., they can be encoded and decoded independently). Argument \code{value} is holds @@ -316,35 +316,35 @@ the value of the option that has become effective as a result of this RPC. -\subsection{\code{\defn{SANE\_NET\_GET\_PARAMETERS}}} +\subsection{\code{\defn{SANE_NET_GET_PARAMETERS}}} This RPC is used to obtain the scan parameters of a remote SANE device. \begin{center} \begin{tabular}{ll} {\bf request:} & {\bf reply:} \\ - \code{SANE\_Word handle} & \code{SANE\_Status status} \\ - & \code{SANE\_Parameters params} \\ + \code{SANE_Word handle} & \code{SANE_Status status} \\ + & \code{SANE_Parameters params} \\ \end{tabular} \end{center} The \code{handle} argument identifies the connection to the remote device whose scan parameters should be returned. In the reply, \code{status} indicates the completion status. If the -value is anything other than \code{SANE\_STA\-TUS\_SUC\-CESS}, the +value is anything other than \code{SANE_STATUS_SUCCESS}, the remainder of the reply has undefined values. The argument \code{params} is used to return the scan parameters. -\subsection{\code{\defn{SANE\_NET\_START}}} +\subsection{\code{\defn{SANE_NET_START}}} This RPC is used to start image acquisition (scanning). \begin{center} \begin{tabular}{ll} {\bf request:} & {\bf reply:} \\ - \code{SANE\_Word handle} & \code{SANE\_Status status} \\ - & \code{SANE\_Word port} \\ - & \code{SANE\_Word byte\_order} \\ - & \code{SANE\_String resource} \\ + \code{SANE_Word handle} & \code{SANE_Status status} \\ + & \code{SANE_Word port} \\ + & \code{SANE_Word byte_order} \\ + & \code{SANE_String resource} \\ \end{tabular} \end{center} The \code{handle} argument identifies the connection to the remote @@ -356,7 +356,7 @@ this value is non-\code{NULL}, all other arguments have undefined values (see Section~\ref{sec:authorization} for details on how to authorize a resource). Argument, \code{status} indicates the completion status. If the value is anything other than -\code{SANE\_STA\-TUS\_SUCCESS}, the remainder of the reply has +\code{SANE_STATUS_SUCCESS}, the remainder of the reply has undefined values. The argument \code{port} returns the port number from which the image data will be available. To read the image data, a network client must connect to the remote host at the indicated port @@ -366,14 +366,14 @@ bytes. The data length is transmitted as a sequence of four bytes. These bytes should be interpreted as an unsigned integer in big-endian format. The four length bytes are followed by the number of data bytes indicated by the length. Except for byte-order, the data is in -the same format as defined for \code{sane\_read()}. Since some +the same format as defined for \code{sane_read()}. Since some records may contain no data at all, a length value of zero is perfectly valid. The special length value of \code{0xffffffff} is used to indicate the end of the data stream. That is, after receiving a record length of \code{0xffffffff}, the network client should close the data connection and stop reading data. -Argument \code{byte\_order} specifies the byte-order of the image +Argument \code{byte_order} specifies the byte-order of the image data. A value of 0x1234 indicates little-endian format, a value of 0x4321 indicates big-endian format. All other values are presently undefined and reserved for future enhancements of this protocol. The @@ -385,14 +385,14 @@ client side when there is a byte-order mismatch. Putting the burden on the client-side improves the scalability properties of this protocol. -\subsection{\code{\defn{SANE\_NET\_CANCEL}}} +\subsection{\code{\defn{SANE_NET_CANCEL}}} This RPC is used to cancel the current operation of a remote SANE device. \begin{center} \begin{tabular}{ll} {\bf request:} & {\bf reply:} \\ - \code{SANE\_Word handle} & \code{SANE\_Word dummy} \\ + \code{SANE_Word handle} & \code{SANE_Word dummy} \\ \end{tabular} \end{center} The \code{handle} argument identifies the connection whose operation @@ -402,7 +402,7 @@ In the reply, the \code{dummy} argument is unused. Its purpose is to ensure proper synchronization (without it, a net client would not be able to determine when the RPC has completed). -\subsection{\code{\defn{SANE\_NET\_AUTHORIZE}}}\label{sec:authorization} +\subsection{\code{\defn{SANE_NET_AUTHORIZE}}}\label{sec:authorization} \index{network authorization} This RPC is used to pass authorization data from the net client to the @@ -410,9 +410,9 @@ net server. \begin{center} \begin{tabular}{ll} {\bf request:} & {\bf reply:} \\ - \code{SANE\_String resource} & \code{SANE\_Word dummy} \\ - \code{SANE\_String username} & \\ - \code{SANE\_String password} & \\ + \code{SANE_String resource} & \code{SANE_Word dummy} \\ + \code{SANE_String username} & \\ + \code{SANE_String password} & \\ \end{tabular} \end{center} The \code{resource} argument specifies the name of the resource to be @@ -430,12 +430,12 @@ will retry the RPC that resulted in the authorization request until that call succeeds (or until the request is cancelled). -\subsection{\code{\defn{SANE\_NET\_EXIT}}} +\subsection{\code{\defn{SANE_NET_EXIT}}} This RPC is used to disconnect a net client from a net server. There are no request or reply arguments in this call. As a result of this call, the connection between the client and the server that was -established by the \code{SANE\_NET\_INIT} call will be closed. +established by the \code{SANE_NET_INIT} call will be closed. % Local Variables: % mode: latex diff --git a/sane.tex b/sane.tex index 95f94a9..b72ec09 100644 --- a/sane.tex +++ b/sane.tex @@ -20,10 +20,10 @@ \begin{document} -\newcommand{\filename}[1]{{\tt #1}} -\newcommand{\code}[1]{{\tt #1}} -\newcommand{\var}[1]{{\it #1}} -\newcommand{\defn}[1]{#1\index{#1}} +% \newcommand{\filename}[1]{{\tt #1}} +% \newcommand{\code}[1]{{\tt #1}} +% \newcommand{\var}[1]{{\it #1}} +% \newcommand{\defn}[1]{#1\index{#1}} \begin{latexonly} \setcounter{changebargrey}{0} % black change bars @@ -149,7 +149,7 @@ platform dependent. Several possibilities exist: simultaneously by implementing a meta backend that manages several backends that have been compiled in such a manner that they export unique function names. For example, a backend called \code{be} - would normally export a function called \code{sane\_read()}. If + would normally export a function called \code{sane_read()}. If each backend would provide such a function, static linking would fail due to multiple conflicting definitions of the same symbol. This can be resolved by having backend \code{be} include a @@ -160,7 +160,7 @@ platform dependent. Several possibilities exist: \end{verbatim} \end{quote} With definitions of this kind, backend \code{be} will export - function name \code{be\_sane\_read()}. Thus, all backends will + function name \code{be_sane_read()}. Thus, all backends will export unique names. As long as a meta backend knows about these names, it is possible to combine several backends at link time and select and use them dynamically at runtime. @@ -170,7 +170,7 @@ platform dependent. Several possibilities exist: that support it. In this case, a frontend is linked against a shared library that implements any SANE backend. Since each dynamically linked backend exports the same set of global symbols - (all starting with the prefix \code{sane\_}), the dynamic library + (all starting with the prefix \code{sane_}), the dynamic library that gets loaded at runtime does not necessarily have to be the same one as one the frontend got linked against. In other words, it is possible to switch the backend by installing the appropriate backend @@ -313,35 +313,35 @@ frame types: \begin{quote} \begin{description} -\item[\code{\defn{SANE\_FRAME\_GRAY}}:] The frame contains a single +\item[\code{\defn{SANE_FRAME_GRAY}}:] The frame contains a single channel of data that represents sample values from a spectral band that covers the human visual range. The image consists of this frame only. -\item[\code{\defn{SANE\_FRAME\_RGB}}:] The frame contains three +\item[\code{\defn{SANE_FRAME_RGB}}:] The frame contains three channels of data that represent sample values from the red, green, and blue spectral bands. The sample values are interleaved in the order red, green, and blue. The image consists of this frame only. -\item[\code{\defn{SANE\_FRAME\_RED}}:] The frame contains one channel +\item[\code{\defn{SANE_FRAME_RED}}:] The frame contains one channel of data that represents sample values from the red spectral band. The complete image consists of three frames: - \code{SANE\_\-FRA\-ME\_RED}, \code{SANE\_FRAME\_GREEN}, and - \code{SANE\_FRAME\_BLUE}. The order in which the frames are + \code{SANE_FRAME_RED}, \code{SANE_FRAME_GREEN}, and + \code{SANE_FRAME_BLUE}. The order in which the frames are transmitted chosen by the backend. -\item[\code{\defn{SANE\_FRAME\_GREEN}}:] The frame contains one +\item[\code{\defn{SANE_FRAME_GREEN}}:] The frame contains one channel of data that represents sample values from the green spectral band. The complete image consists of three frames: - \code{SANE\_\-FRA\-ME\_RED}, \code{SANE\_FRAME\_GREEN}, and - \code{SANE\_FRAME\_BLUE}. The order in which the frames are + \code{SANE_FRAME_RED}, \code{SANE_FRAME_GREEN}, and + \code{SANE_FRAME_BLUE}. The order in which the frames are transmitted chosen by the backend. -\item[\code{\defn{SANE\_FRAME\_BLUE}}:] The frame contains one channel +\item[\code{\defn{SANE_FRAME_BLUE}}:] The frame contains one channel of data that represents sample values from the blue spectral band. The complete image consists of three frames: - \code{SANE\_\-FRA\-ME\_RED}, \code{SANE\_FRAME\_GREEN}, and - \code{SANE\_FRAME\_BLUE}. The order in which the frames are + \code{SANE_FRAME_RED}, \code{SANE_FRAME_GREEN}, and + \code{SANE_FRAME_BLUE}. The order in which the frames are transmitted chosen by the backend. \end{description} @@ -389,10 +389,10 @@ The SANE API provides the following five macros to manage version numbers. \begin{quote} \begin{description} - \item[\code{\defn{SANE\_CURRENT\_MAJOR}}:] The value of this macro is the + \item[\code{\defn{SANE_CURRENT_MAJOR}}:] The value of this macro is the number of the SANE standard that the interface implements. - \item[\code{\defn{SANE\_VERSION\_CODE}(\var{maj},\var{min},\var{bld})}:] + \item[\code{\defn{SANE_VERSION_CODE}(\var{maj},\var{min},\var{bld})}:] \label{sec:saneversioncode} This macro can be used to build a monotonically increasing version code. A SANE version code consists of the SANE standard major @@ -411,13 +411,13 @@ numbers. build revision are used for informational and bug-fixing purposes only. - \item[\code{\defn{SANE\_VERSION\_MAJOR}(\var{vc})}:] This macro returns the + \item[\code{\defn{SANE_VERSION_MAJOR}(\var{vc})}:] This macro returns the major version number component of the version code passed in argument \var{vc}. - \item[\code{SANE\_VERSION\_MINOR(\var{vc})}:] This macro returns the + \item[\code{SANE_VERSION_MINOR(\var{vc})}:] This macro returns the minor version number component of the version code passed in argument \var{vc}. - \item[\code{SANE\_VERSION\_BUILD(\var{vc})}:] This macro returns the + \item[\code{SANE_VERSION_BUILD(\var{vc})}:] This macro returns the build revision component of the version code passed in argument \var{vc}. \end{description} @@ -431,8 +431,8 @@ numbers. The SANE standard is based on just two SANE-specific base types: the SANE byte and word. \begin{quote} - \code{typedef \var{some-scalar-type\/} \defn{SANE\_Byte};} \\ - \code{typedef \var{some-scalar-type\/} \defn{SANE\_Word};} + \code{typedef \var{some-scalar-type\/} \defn{SANE_Byte};} \\ + \code{typedef \var{some-scalar-type\/} \defn{SANE_Word};} \end{quote} \verb|SANE_Byte| must correspond to some scalar C type that is capable of holding values in the range 0 to 255. \verb|SANE_Word| must be @@ -452,9 +452,9 @@ therefore not depend on a particular mapping. \subsection{Boolean Type} -\code{\defn{SANE\_Bool}} is used for variables that can take one of -the two truth values \code{\defn{SANE\_FALSE}} and -\code{\defn{SANE\_TRUE}}. The former value is defined to be 0, +\code{\defn{SANE_Bool}} is used for variables that can take one of +the two truth values \code{\defn{SANE_FALSE}} and +\code{\defn{SANE_TRUE}}. The former value is defined to be 0, whereas the latter is 1.\footnote{This is different from ANSI C where any non-zero integer value represents logical TRUE.} The C declarations for this type are given below. @@ -473,7 +473,7 @@ fixed interpretation as a boolean object. \subsection{Integer Type} -\code{\defn{SANE\_Int}} is used for variables that can take integer +\code{\defn{SANE_Int}} is used for variables that can take integer values in the range $-2^{32}$ to $2^{31}-1$. Its C declaration is given below. \begin{quote} @@ -490,7 +490,7 @@ fixed interpretation as an integer object. \subsection{Fixed-point Type} -\code{\defn{SANE\_Fixed}} is used for variables that can take fixed +\code{\defn{SANE_Fixed}} is used for variables that can take fixed point values in the range $-32768$ to $32767.9999$ with a resolution of $1/65535$. The C declarations relating to this type are given below. @@ -500,7 +500,7 @@ below. typedef SANE_Word SANE_Fixed; \end{verbatim} \end{quote} -The macro \code{\defn{SANE\_FIXED\_SCALE\_SHIFT}} gives the location +The macro \code{\defn{SANE_FIXED_SCALE_SHIFT}} gives the location of the fixed binary point. This standard defines that value to be 16, which yields a resolution of $1/65536$. @@ -515,12 +515,12 @@ values to and from C double floating point values. \begin{quote} \begin{description} - \item[\code{\defn{SANE\_FIX}(\var{d})}:] Returns the largest SANE + \item[\code{\defn{SANE_FIX}(\var{d})}:] Returns the largest SANE fixed-point value that is smaller than the double value \var{d}. No range checking is performed. If the value of \var{d} is out of range, the result is undefined. - \item[\code{\defn{SANE\_UNFIX}(\var{w})}:] Returns the nearest + \item[\code{\defn{SANE_UNFIX}(\var{w})}:] Returns the nearest double machine number that corresponds to fixed-point value \var{w}. @@ -543,14 +543,14 @@ between the two representations. \subsubsection{Character Type} -Type \code{\defn{SANE\_Char}} represents a single text character or +Type \code{\defn{SANE_Char}} represents a single text character or symbol. At present, this type maps directly to the underlying C \verb|char| type (typically one byte). The encoding for such characters is currently fixed as ISO LATIN-1. Future versions of this standard may map this type to a wider type and allow multi-byte encodings to support internationalization. As a result of this, care should be taken to avoid the assumption that -\verb|sizeof(SANE\_Char)==sizeof(char)|. +\verb|sizeof(SANE_Char)==sizeof(char)|. \begin{quote} \begin{verbatim} typedef char SANE_Char; @@ -559,7 +559,7 @@ typedef char SANE_Char; \subsubsection{String Type} -Type \code{\defn{SANE\_String}} represents a text string as a sequence +Type \code{\defn{SANE_String}} represents a text string as a sequence of C \verb|char| values. The end of the sequence is indicated by a \verb|'\0'| (\defn{NUL}) character. \begin{quote} @@ -568,7 +568,7 @@ typedef SANE_Char *SANE_String; typedef const SANE_Char *SANE_String_Const; \end{verbatim} \end{quote} -The type \code{\defn{SANE\_String\_Const}} is provided by SANE to +The type \code{\defn{SANE_String_Const}} is provided by SANE to enable declaring strings whose contents is unchangable. Note that in ANSI C, the declaration \begin{quote} @@ -583,7 +583,7 @@ points to a constant value). \subsection{Scanner Handle Type} Access to a scanner is provided through an opaque type called -\code{\defn{SANE\_Handle}}. The C declaration of this type is given +\code{\defn{SANE_Handle}}. The C declaration of this type is given below. \begin{quote} \begin{verbatim} @@ -598,13 +598,13 @@ pointer value. \subsection{Status Type} -Most SANE operations return a value of type \code{\defn{SANE\_Status}} +Most SANE operations return a value of type \code{\defn{SANE_Status}} to indicate whether the completion status of the operation. If an operation completes successfully, \verb|SANE_STATUS_GOOD| is returned. In case of an error, a value is returned that indicates the nature of the problem. The complete list of available status codes is listed in Table \ref{tab:status}. It is recommended to use function -\code{sane\_strstatus()} to convert status codes into a legible +\code{sane_strstatus()} to convert status codes into a legible string. \begin{table}[htbp] @@ -614,29 +614,29 @@ string. \multicolumn{1}{|c|}{\bf Symbol} & \multicolumn{1}{c|}{\bf Code} & \multicolumn{1}{c|}{\bf Description} \\ \hline\hline -\code{\defn{SANE\_STATUS\_GOOD}} +\code{\defn{SANE_STATUS_GOOD}} & 0 & Operation completed succesfully. \\ -\code{\defn{SANE\_STATUS\_UNSUPPORTED}} +\code{\defn{SANE_STATUS_UNSUPPORTED}} & 1 & Operation is not supported. \\ -\code{\defn{SANE\_STATUS\_CANCELLED}} +\code{\defn{SANE_STATUS_CANCELLED}} & 2 & Operation was cancelled. \\ -\code{\defn{SANE\_STATUS\_DEVICE\_BUSY}} +\code{\defn{SANE_STATUS_DEVICE_BUSY}} & 3 & Device is busy---retry later. \\ -\code{\defn{SANE\_STATUS\_INVAL}} +\code{\defn{SANE_STATUS_INVAL}} & 4 & Data or argument is invalid. \\ -\code{\defn{SANE\_STATUS\_EOF}} +\code{\defn{SANE_STATUS_EOF}} & 5 & No more data available (end-of-file). \\ -\code{\defn{SANE\_STATUS\_JAMMED}} +\code{\defn{SANE_STATUS_JAMMED}} & 6 & Document feeder jammed. \\ -\code{\defn{SANE\_STATUS\_NO\_DOCS}} +\code{\defn{SANE_STATUS_NO_DOCS}} & 7 & Document feeder out of documents. \\ -\code{\defn{SANE\_STATUS\_COVER\_OPEN}} +\code{\defn{SANE_STATUS_COVER_OPEN}} & 8 & Scanner cover is open. \\ -\code{\defn{SANE\_STATUS\_IO\_ERROR}} +\code{\defn{SANE_STATUS_IO_ERROR}} & 9 & Error during device I/O. \\ -\code{\defn{SANE\_STATUS\_NO\_MEM}} +\code{\defn{SANE_STATUS_NO_MEM}} & 10 & Out of memory. \\ -\code{\defn{SANE\_STATUS\_ACCESS\_DENIED}} +\code{\defn{SANE_STATUS_ACCESS_DENIED}} & 11 & Access to resource has been denied. \\ \hline \end{tabular} @@ -648,7 +648,7 @@ string. \subsection{Device Descriptor Type} Each SANE device is represented by a structure of type -\code{\defn{SANE\_Device}}. The C declaration of this type is given +\code{\defn{SANE_Device}}. The C declaration of this type is given below. \begin{quote} \begin{verbatim} @@ -665,7 +665,7 @@ SANE_Device; \index{device-name} The structure provides the unique name of the scanner in member \code{name}. It is this unique name that should be passed in a call -to \code{sane\_open()}. The format of this name is completely up to +to \code{sane_open()}. The format of this name is completely up to the backend. The only constraints are that the name is unique among all devices supported by the backend and that the name is a legal SANE text string. To simplify presentation of unique names, their length @@ -732,7 +732,7 @@ control a scanner abstractly, without requiring knowledge as to what the purpose of any given option is. Conversely, a scanner can describe its controls without requiring knowledge of how the frontend operates. The C declaration of the -\code{\defn{SANE\_Option\_Descriptor}} type is given below. +\code{\defn{SANE_Option_Descriptor}} type is given below. \begin{quote} \begin{verbatim} typedef struct @@ -784,7 +784,7 @@ breaks. \subsubsection{Option Value Type} Member \code{type} specifies the type of the option value. The -possible values for type \code{\defn{SANE\_Value\_Type}} are described +possible values for type \code{\defn{SANE_Value_Type}} are described in Table \ref{tab:valuetype}. \begin{table}[htbp] @@ -797,25 +797,25 @@ in Table \ref{tab:valuetype}. \multicolumn{1}{c|}{\bf Description} \\ \hline\hline -\code{\defn{SANE\_TYPE\_BOOL}} & 0 & Option value is of type +\code{\defn{SANE_TYPE_BOOL}} & 0 & Option value is of type \verb|SANE_Bool|. \\ -\code{\defn{SANE\_TYPE\_INT}} & 1 & Option value is of type +\code{\defn{SANE_TYPE_INT}} & 1 & Option value is of type \verb|SANE_Int|. \\ -\code{\defn{SANE\_TYPE\_FIXED}}&2 & Option value is of type +\code{\defn{SANE_TYPE_FIXED}}&2 & Option value is of type \verb|SANE_Fixed|. \\ -\code{\defn{SANE\_TYPE\_STRING}}&3 & Option value is of type +\code{\defn{SANE_TYPE_STRING}}&3 & Option value is of type \verb|SANE_String|. \\ -\code{\defn{SANE\_TYPE\_BUTTON}} & 4 & An option of this type has no value. +\code{\defn{SANE_TYPE_BUTTON}} & 4 & An option of this type has no value. Instead, setting an option of this type has an option-specific side-effect. For example, a button-typed option could be used by a backend to provide a means to select default values or to the tell an automatic document feeder to advance to the next sheet of paper. \\ -\code{\defn{SANE\_TYPE\_GROUP}} & 5 & An option of this type has no value. +\code{\defn{SANE_TYPE_GROUP}} & 5 & An option of this type has no value. This type is used to group logically related options. A group option is in effect up to the point where another group option is encountered (or up to the end of the option list, if there are no other group @@ -824,7 +824,7 @@ options). For group options, only members \code{title} and \hline \end{tabular} - \caption{Option Value Types (\code{SANE\_Value\_Type})} + \caption{Option Value Types (\code{SANE_Value_Type})} \label{tab:valuetype} \end{center} \end{table} @@ -832,7 +832,7 @@ options). For group options, only members \code{title} and \subsubsection{Option Value Unit} Member \code{unit} specifies what the physical unit of the option -value is. The possible values for type \code{\defn{SANE\_U\-nit}} are +value is. The possible values for type \code{\defn{SANE_Unit}} are described in Table \ref{tab:units}. Note that the specified unit is what the SANE backend expects. It is entirely up to a frontend as to how these units a presented to the user. For example, SANE expresses @@ -851,17 +851,17 @@ quantities in a customary unit (e.g., inches or centimeters). \hline\hline -\code{\defn{SANE\_UNIT\_NONE}} & 0 & Value is unit-less (e.g., page count).\\ -\code{\defn{SANE\_UNIT\_PIXEL}} & 1 & Value is in number of pixels. \\ -\code{\defn{SANE\_UNIT\_BIT}} & 2 & Value is in number of bits. \\ -\code{\defn{SANE\_UNIT\_MM}} & 3 & Value is in millimeters. \\ -\code{\defn{SANE\_UNIT\_DPI}} & 4 & Value is a resolution in dots/inch. \\ -\code{\defn{SANE\_UNIT\_PERCENT}}& 5 & Value is a percentage. \\ -\code{\defn{SANE\_UNIT\_MICROSECOND}}& 6 & Value is time in $\mu$-seconds. \\ +\code{\defn{SANE_UNIT_NONE}} & 0 & Value is unit-less (e.g., page count).\\ +\code{\defn{SANE_UNIT_PIXEL}} & 1 & Value is in number of pixels. \\ +\code{\defn{SANE_UNIT_BIT}} & 2 & Value is in number of bits. \\ +\code{\defn{SANE_UNIT_MM}} & 3 & Value is in millimeters. \\ +\code{\defn{SANE_UNIT_DPI}} & 4 & Value is a resolution in dots/inch. \\ +\code{\defn{SANE_UNIT_PERCENT}}& 5 & Value is a percentage. \\ +\code{\defn{SANE_UNIT_MICROSECOND}}& 6 & Value is time in $\mu$-seconds. \\ \hline \end{tabular} - \caption{Physical Units (\code{SANE\_Unit})} + \caption{Physical Units (\code{SANE_Unit})} \label{tab:units} \end{center} \end{table} @@ -873,18 +873,18 @@ This member has a slightly different interpretation depending on the type of the option value: \begin{quote} \begin{description} - \item[\code{SANE\_TYPE\_STRING}:] The size is the maximum size of + \item[\code{SANE_TYPE_STRING}:] The size is the maximum size of the string. For the purpose of string size calcuations, the terminating \code{NUL} character is considered to be part of the string. Note that the terminating \code{NUL} character must always be present in string option values. - \item[\code{SANE\_TYPE\_INT}, \code{SANE\_TYPE\_FIXED}:] The size + \item[\code{SANE_TYPE_INT}, \code{SANE_TYPE_FIXED}:] The size must be a positive integer multiple of the size of a \verb|SANE_Word|. The option value is a vector of length - \[ \code{size}/\code{sizeof(SANE\_Word)}. \] - \item[\code{SANE\_TYPE\_BOOL}:] The size must be set to - \code{sizeof(SANE\_Word)}. - \item[\code{SANE\_TYPE\_BUTTON}, \code{SANE\_TYPE\_GROUP}:] The + \[ \code{size}/\code{sizeof(SANE_Word)}. \] + \item[\code{SANE_TYPE_BOOL}:] The size must be set to + \code{sizeof(SANE_Word)}. + \item[\code{SANE_TYPE_BUTTON}, \code{SANE_TYPE_GROUP}:] The option size is ignored. \end{description} \end{quote} @@ -899,12 +899,12 @@ capability bitset: \begin{quote} \begin{description} - \item[\code{\defn{SANE\_OPTION\_IS\_ACTIVE}(\var{cap})}:] This macro - returns \code{SANE\_TRUE} if and only if the option with the + \item[\code{\defn{SANE_OPTION_IS_ACTIVE}(\var{cap})}:] This macro + returns \code{SANE_TRUE} if and only if the option with the capability set \var{cap} is currently active. - \item[\code{\defn{SANE\_OPTION\_IS\_SETTABLE}(\var{cap})}:] This - macro returns \code{SANE\_TRUE} if and only if the option with the + \item[\code{\defn{SANE_OPTION_IS_SETTABLE}(\var{cap})}:] This + macro returns \code{SANE_TRUE} if and only if the option with the capability set \var{cap} is software settable. \end{description} \end{quote} @@ -919,42 +919,42 @@ capability bitset: \multicolumn{1}{c|}{\bf Description} \\ \hline\hline -\code{\defn{SANE\_CAP\_SOFT\_SELECT}} & 1 & The option - value can be set by a call to \code{sane\_con\-trol\_opt\-ion()}.\\ +\code{\defn{SANE_CAP_SOFT_SELECT}} & 1 & The option + value can be set by a call to \code{sane_control_option()}.\\ -\code{\defn{SANE\_CAP\_HARD\_SELECT}} & 2 & The option value can be set by +\code{\defn{SANE_CAP_HARD_SELECT}} & 2 & The option value can be set by user-intervention (e.g., by flipping a switch). The user-interface should prompt the user to execute the appropriate action to set such an option. This capability is mutually exclusive with - SANE\_CAP\_SOFT\_SELECT (either one of them can be set, but not both + SANE_CAP_SOFT_SELECT (either one of them can be set, but not both simultaneously). \\ -\code{\defn{SANE\_CAP\_SOFT\_DETECT}} & 4 & The option +\code{\defn{SANE_CAP_SOFT_DETECT}} & 4 & The option value can be detected by software. If - \code{SANE\_\-CAP\_\-SO\-FT\_SEL\-ECT} is set, this capability {\em must\/} - be set. If \code{SANE\_CAP\_HARD\_SELECT} is set, this capability + \code{SANE_CAP_SOFT_SELECT} is set, this capability {\em must\/} + be set. If \code{SANE_CAP_HARD_SELECT} is set, this capability may or may not be set. If this capability is set but neither - \code{SANE\_CAP\_SO\-FT\_SEL\-ECT} nor \code{SANE\_CAP\_HA\-RD\_SEL\-ECT} + \code{SANE_CAP_SOFT_SELECT} nor \code{SANE_CAP_HARD_SELECT} are, then there is no way to control the option. That is, the option provides read-out of the current value only. \\ -\code{\defn{SANE\_CAP\_EMULATED}} & 8 & If set, this capability indicates +\code{\defn{SANE_CAP_EMULATED}} & 8 & If set, this capability indicates that an option is not directly supported by the device and is instead emulated in the backend. A sophisticated frontend may elect to use its own (presumably better) emulation in lieu of an emulated option. \\ -\code{\defn{SANE\_CAP\_AUTOMATIC}} & 16 & If set, this capability indicates +\code{\defn{SANE_CAP_AUTOMATIC}} & 16 & If set, this capability indicates that the backend (or the device) is capable to picking a reasonable option value automatically. For such options, it is possible to - select automatic operation by calling \code{sane\_control\_option()} - with an action value of \code{SANE\_ACTION\_SET\_AUTO}. \\ + select automatic operation by calling \code{sane_control_option()} + with an action value of \code{SANE_ACTION_SET_AUTO}. \\ -\code{\defn{SANE\_CAP\_INACTIVE}} & 32 & If set, this capability indicates +\code{\defn{SANE_CAP_INACTIVE}} & 32 & If set, this capability indicates that the option is not currently active (e.g., because it's meaningful only if another option is set to some other value). \\ -\code{\defn{SANE\_CAP\_ADVANCED}} & 64 & +\code{\defn{SANE_CAP_ADVANCED}} & 64 & If set, this capability indicates that the option should be considered an ``advanced user option.'' A frontend typically displays such options in a less conspicuous way than regular options @@ -974,11 +974,11 @@ capability bitset: It is often useful to constrain the values that an option can take. For example, constraints can be used by a frontend to determine how to -represent a given option. Member \code{constraint\_type} indicates +represent a given option. Member \code{constraint_type} indicates what constraint is in effect for the option. The constrained values that are allowed for the option are described by one of the union members of member \code{constraint}. The possible values of type -\code{\defn{SANE\_Constraint\_Type}} and the interpretation of the +\code{\defn{SANE_Constraint_Type}} and the interpretation of the \code{constraint} union is described in Table~\ref{tab:constraints}. \begin{table}[htbp] @@ -992,15 +992,15 @@ members of member \code{constraint}. The possible values of type \hline\hline -\code{\defn{SANE\_CONSTRAINT\_NONE}} & 0 & The value is unconstrained. +\code{\defn{SANE_CONSTRAINT_NONE}} & 0 & The value is unconstrained. The option can take any of the values possible for the option's type. \\ - \code{\defn{SANE\_CONSTRAINT\_RANGE}} & 1 & This constraint is + \code{\defn{SANE_CONSTRAINT_RANGE}} & 1 & This constraint is applicable to integer and fixed-point valued options only. It constrains the option value to a possibly quantized range of numbers. Option descriptor member \code{constraint.range} points to - a range of the type \code{\defn{SANE\_Range}}. This type is illustrated + a range of the type \code{\defn{SANE_Range}}. This type is illustrated below: \begin{quote} \begin{verbatim} @@ -1022,20 +1022,20 @@ SANE_Range; then the legal values are $v=k\cdot q+l$ for all non-negative integer values of $k$ such that $v<=u$. \\ -\code{\defn{SANE\_CONSTRAINT\_WORD\_LIST}} & 2 & This constraint is applicable +\code{\defn{SANE_CONSTRAINT_WORD_LIST}} & 2 & This constraint is applicable to integer and fixed-point valued options only. It constrains the option value to a list of numeric values. Option descriptor member - \code{constraint.word\_list} points to a list of words that + \code{constraint.word_list} points to a list of words that enumerates the legal values. The first element in that list is an integer (\verb|SANE_Int|) that specifies the length of the list (not counting the length itself). The remaining elements in the list are interpreted according to the type of the option value (\verb|SANE_TYPE_INT| or \verb|SANE_TYPE_FIXED|). \\ -\code{\defn{SANE\_CONSTRAINT\_STRING\_LIST}} & 3 & This constraint is +\code{\defn{SANE_CONSTRAINT_STRING_LIST}} & 3 & This constraint is applicable to string-valued options only. It constrains the option value to a list of strings. The option descriptor member - \code{con\-strai\-nt.str\-ing\_list} points to a \code{NULL} terminated + \code{constraint.string_list} points to a \code{NULL} terminated list of strings that enumerate the legal values for the option value. \\\hline @@ -1048,18 +1048,18 @@ SANE_Range; \section{Operations} -\subsection{\code{sane\_init}} +\subsection{\code{sane_init}} This function must be called before any other SANE function can be called. The behavior of a SANE backend is undefined if this function is not called first. The version code of the backend is returned in -the value pointed to by \code{version\_code}. If that pointer is +the value pointed to by \code{version_code}. If that pointer is \code{NULL}, no version code is returned. Argument \code{authorize} is either a pointer to a function that is invoked when the backend requires authentication for a specific resource or \code{NULL} if the frontend does not support authentication. -\begin{quote}\index{sane\_init} +\begin{quote}\index{sane_init} \begin{verbatim} SANE_Status sane_init (SANE_Int * version_code, SANE_Authorization_Callback authorize); @@ -1069,7 +1069,7 @@ SANE_Status sane_init (SANE_Int * version_code, The authorization function may be called by a backend in response to any of the following calls: \begin{quote} - \code{sane\_open}, \code{sane\_control\_option}, \code{sane\_start} + \code{sane_open}, \code{sane_control_option}, \code{sane_start} \end{quote} If a backend was initialized without authorization function, then authorization requests that cannot be handled by the backend itself @@ -1081,7 +1081,7 @@ backend could automatically lookup the apporpriate password based on resource- and user-name. The authentication function type has the following declaration: -\begin{quote}\index{SANE\_Authorization\_Callback} +\begin{quote}\index{SANE_Authorization_Callback} \index{domain}\index{username}\index{password} \begin{verbatim} #define SANE_MAX_USERNAME_LEN 256 @@ -1098,50 +1098,50 @@ Three arguments are passed to the authorization function: requires authorization. A frontend should use this string to build a user-prompt requesting a username and a password. The \code{username} and \code{password} arguments are (pointers to) an array of -\code{SANE\_MAX\_USERNAME\_LEN} and \code{SANE\_MAX\_PASSWORD\_LEN} +\code{SANE_MAX_USERNAME_LEN} and \code{SANE_MAX_PASSWORD_LEN} characters, respectively. The authorization call should place the entered username and password in these arrays. The returned strings {\em must\/} be ASCII-NUL terminated. -\subsection{\code{sane\_exit}} +\subsection{\code{sane_exit}} This function must be called to terminate use of a backend. The function will first close all device handles that still might be open (it is recommended to close device handles explicitly through a call -to \code{sane\_clo\-se()}, but backends are required to release all +to \code{sane_close()}, but backends are required to release all resources upon a call to this function). After this function returns, -no function other than \code{sane\_init()} may be called (regardless -of the status value returned by \code{sane\_exit()}. Neglecting to +no function other than \code{sane_init()} may be called (regardless +of the status value returned by \code{sane_exit()}. Neglecting to call this function may result in some resources not being released properly. -\begin{quote}\index{sane\_exit} +\begin{quote}\index{sane_exit} \begin{verbatim} void sane_exit (void); \end{verbatim} \end{quote} -\subsection{\code{sane\_get\_devices}} +\subsection{\code{sane_get_devices}} This function can be used to query the list of devices that are available. If the function executes successfully, it stores a pointer to a \code{NULL} terminated array of pointers to \verb|SANE_Device| -structures in \code{*device\_list}. The returned list is guaranteed +structures in \code{*device_list}. The returned list is guaranteed to remain unchanged and valid until (a) another call to this function -is performed or (b) a call to \code{sane\_exit()} is performed. This +is performed or (b) a call to \code{sane_exit()} is performed. This function can be called repeatedly to detect when new devices become -available. If argument \code{local\_only} is true, only local devices +available. If argument \code{local_only} is true, only local devices are returned (devices directly attached to the machine that SANE is running on). If it is false, the device list includes all remote devices that are accessible to the SANE library. -\begin{quote}\index{sane\_get\_devices} +\begin{quote}\index{sane_get_devices} \begin{verbatim} SANE_Status sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only); \end{verbatim} \end{quote} -This function may fail with \code{SANE\_STATUS\_NO\_MEM} if an +This function may fail with \code{SANE_STATUS_NO_MEM} if an insufficient amount of memory is available. \begin{quote} @@ -1149,13 +1149,13 @@ insufficient amount of memory is available. {\bf Backend Implementation Note} \end{center} SANE does not require that this function is called before a - \code{sane\_open()} call is performed. A device name may be + \code{sane_open()} call is performed. A device name may be specified explicitly by a user which would make it unnecessary and undesirable to call this function first. \end{quote} -\subsection{\code{sane\_open}} +\subsection{\code{sane_open}} This function is used to establish a connection to a particular device. The name of the device to be opened is passed in argument @@ -1163,7 +1163,7 @@ device. The name of the device to be opened is passed in argument device is returned in \code{*h}. As a special case, specifying a zero-length string as the device requests opening the first available device (if there is such a device). -\begin{quote}\index{sane\_open} +\begin{quote}\index{sane_open} \begin{verbatim} SANE_Status sane_open (SANE_String_Const name, SANE_Handle * h); \end{verbatim} @@ -1172,34 +1172,34 @@ SANE_Status sane_open (SANE_String_Const name, SANE_Handle * h); This function may fail with one of the following status codes. \begin{quote} \begin{description} -\item[\code{SANE\_STATUS\_DEVICE\_BUSY}:] The device is currently +\item[\code{SANE_STATUS_DEVICE_BUSY}:] The device is currently busy (in use by somebody else). -\item[\code{SANE\_STATUS\_INVAL}:] The device name is not valid. -\item[\code{SANE\_STATUS\_IO\_ERROR}:] An error occured while +\item[\code{SANE_STATUS_INVAL}:] The device name is not valid. +\item[\code{SANE_STATUS_IO_ERROR}:] An error occured while communicating with the device. -\item[\code{SANE\_STATUS\_NO\_MEM}:] An insufficent amount of memory +\item[\code{SANE_STATUS_NO_MEM}:] An insufficent amount of memory is available. -\item[\code{SANE\_STATUS\_ACCESS\_DENIED}:] Access to the device has +\item[\code{SANE_STATUS_ACCESS_DENIED}:] Access to the device has been denied due to insufficient or invalid authentication. \end{description} \end{quote} -\subsection{\code{sane\_close}} +\subsection{\code{sane_close}} This function terminates the association between the device handle passed in argument \code{h} and the device it represents. If the -device is presently active, a call to \code{sane\_cancel()} is +device is presently active, a call to \code{sane_cancel()} is performed first. After this function returns, handle \code{h} must not be used anymore. -\begin{quote}\index{sane\_close} +\begin{quote}\index{sane_close} \begin{verbatim} void sane_close (SANE_Handle h); \end{verbatim} \end{quote} -\subsection{\code{sane\_get\_option\_descriptor}} +\subsection{\code{sane_get_option_descriptor}} This function is used to access option descriptors. The function returns the option descriptor for option number \code{n} of the device @@ -1210,14 +1210,14 @@ includes option 0). If $n$ is not a valid option index, the function returns \code{NULL}. The returned option descriptor is guaranteed to remain valid (and at the returned address) until the device is closed. -\begin{quote}\index{sane\_get\_option\_descriptor} +\begin{quote}\index{sane_get_option_descriptor} \begin{verbatim} const SANE_Option_Descriptor * sane_get_option_descriptor (SANE_Handle h, SANE_Int n); \end{verbatim} \end{quote} -\subsection{\code{sane\_control\_option}}\label{sec:control} +\subsection{\code{sane_control_option}}\label{sec:control} This function is used to set or inquire the current value of option number \code{n} of the device represented by handle \code{h}. The @@ -1235,7 +1235,7 @@ terminator in the string. If argument \code{i} is not \code{NULL}, the value of \code{*i} will be set to provide details on how well the request has been met. The meaning of this argument is described in more detail below. -\begin{quote}\index{sane\_control\_option} +\begin{quote}\index{sane_control_option} \begin{verbatim} SANE_Status sane_control_option (SANE_Handle h, SANE_Int n, SANE_Action a, void *v, @@ -1245,7 +1245,7 @@ SANE_Status sane_control_option (SANE_Handle h, SANE_Int n, The way the option is affected by a call to this function is controlled by parameter \code{a} which is a value of type -\code{\defn{SANE\_Action}}. The possible values and their meaning is +\code{\defn{SANE_Action}}. The possible values and their meaning is described in Table~\ref{tab:actions}. \begin{table}[h] @@ -1259,13 +1259,13 @@ described in Table~\ref{tab:actions}. \hline\hline -\code{\defn{SANE\_ACTION\_GET\_VALUE}} & 0 & Get current option value. \\ +\code{\defn{SANE_ACTION_GET_VALUE}} & 0 & Get current option value. \\ -\code{\defn{SANE\_ACTION\_SET\_VALUE}} & 1 & Set option value. The +\code{\defn{SANE_ACTION_SET_VALUE}} & 1 & Set option value. The option value passed through argument \code{v} may be modified by the backend if the value cannot be set exactly. \\ -\code{\defn{SANE\_ACTION\_SET\_AUTO}} & 2 & Turn on automatic mode. Backend +\code{\defn{SANE_ACTION_SET_AUTO}} & 2 & Turn on automatic mode. Backend or device will automatically select an appropriate value. This mode remains effective until overridden by an explicit set value request. The value of parameter \code{v} is completely ignored in this case and @@ -1273,7 +1273,7 @@ described in Table~\ref{tab:actions}. \hline \end{tabular} - \caption{Action Values (\code{SANE\_Action})} + \caption{Action Values (\code{SANE_Action})} \label{tab:actions} \end{center} \end{table} @@ -1294,7 +1294,7 @@ combination of the values described in Table~\ref{tab:info}. \hline\hline -\code{\defn{SANE\_INFO\_INEXACT}} & 1 & This value is returned when +\code{\defn{SANE_INFO_INEXACT}} & 1 & This value is returned when setting an option value resulted in a value being selected that does not exactly match the requested value. For example, if a scanner can adjust the resolution in increments of 30dpi only, setting the @@ -1306,15 +1306,15 @@ combination of the values described in Table~\ref{tab:info}. choose to ``round'' a string to the closest matching legal string for a constrained string value. \\ - \code{\defn{SANE\_INFO\_RELOAD\_OPTIONS}} & 2 & The setting of an + \code{\defn{SANE_INFO_RELOAD_OPTIONS}} & 2 & The setting of an option may affect the value or availability of one or more {\em other\/} options. When this happens, the SANE backend sets this member in \code{*i} to indicate that the application should reload all options. This member may be set if and only if at least one option changed. \\ -\code{\defn{SANE\_INFO\_RELOAD\_PARAMS}} & 4 & The setting of an option may - affect the parameter values (see \code{sane\_get\_parameters()}). +\code{\defn{SANE_INFO_RELOAD_PARAMS}} & 4 & The setting of an option may + affect the parameter values (see \code{sane_get_parameters()}). If setting an option affects the parameter values, this member will be set in \code{*i}. Note that this member may be set even if the parameters did not actually change. However, it is guaranteed that @@ -1330,35 +1330,35 @@ combination of the values described in Table~\ref{tab:info}. This function may fail with one of the following status codes. \begin{quote} \begin{description} -\item[\code{SANE\_STATUS\_UNSUPPORTED}:] The operation is not +\item[\code{SANE_STATUS_UNSUPPORTED}:] The operation is not supported for the specified handle and option number. -\item[\code{SANE\_STATUS\_INVAL}:] The option value is not valid. -\item[\code{SANE\_STATUS\_IO\_ERROR}:] An error occured while +\item[\code{SANE_STATUS_INVAL}:] The option value is not valid. +\item[\code{SANE_STATUS_IO_ERROR}:] An error occured while communicating with the device. -\item[\code{SANE\_STATUS\_NO\_MEM}:] An insufficent amount of memory +\item[\code{SANE_STATUS_NO_MEM}:] An insufficent amount of memory is available. -\item[\code{SANE\_STATUS\_ACCESS\_DENIED}:] Access to the option has +\item[\code{SANE_STATUS_ACCESS_DENIED}:] Access to the option has been denied due to insufficient or invalid authentication. \end{description} \end{quote} -\subsection{\code{sane\_get\_parameters}} +\subsection{\code{sane_get_parameters}} This function is used to obtain the current scan parameters. The returned parameters are guaranteed to be accurate between the time a -scan has been started (\code{sane\_start()} has been called) and the +scan has been started (\code{sane_start()} has been called) and the completion of that request. Outside of that window, the returned values are best-effort estimates of what the parameters will be when -\code{sane\_start()} gets invoked. Calling this function before a +\code{sane_start()} gets invoked. Calling this function before a scan has actually started allows, for example, to get an estimate of how big the scanned image will be. The parameters passed to this function are the handle \code{h} of the device for which the parameters should be obtained and a pointer \code{p} to a parameter structure. The parameter structure is described in more detail below. -\begin{quote}\index{sane\_get\_parameters} +\begin{quote}\index{sane_get_parameters} \begin{verbatim} SANE_Status sane_get_parameters (SANE_Handle h, SANE_Parameters * p); @@ -1366,7 +1366,7 @@ SANE_Status sane_get_parameters (SANE_Handle h, \end{quote} The scan parameters are returned in a structure of type -\code{\defn{SANE\_Parameters}}. The C declaration of this structure +\code{\defn{SANE_Parameters}}. The C declaration of this structure is given below. \begin{quote} \begin{verbatim} @@ -1384,7 +1384,7 @@ SANE_Parameters; \end{quote} Member \code{format} specifies the format of the next frame to be -returned. The possible values for type \code{\defn{SANE\_Frame}} are +returned. The possible values for type \code{\defn{SANE_Frame}} are described in Table~\ref{tab:frameformat}. The meaning of these values is described in more detail in Section~\ref{sec:imageformat}. \begin{table}[htbp] @@ -1398,20 +1398,20 @@ values is described in more detail in Section~\ref{sec:imageformat}. \hline\hline -\code{\defn{SANE\_FRAME\_GRAY}} & 0 & Band covering human visual range. \\ -\code{\defn{SANE\_FRAME\_RGB}} & 1 & Pixel-interleaved red/green/blue bands. \\ -\code{\defn{SANE\_FRAME\_RED}} & 2 & Red band of a red/green/blue image. \\ -\code{\defn{SANE\_FRAME\_GREEN}} & 3 & Green band of a red/green/blue image. \\ -\code{\defn{SANE\_FRAME\_BLUE}} & 4 & Blue band of a red/green/blue image. \\ +\code{\defn{SANE_FRAME_GRAY}} & 0 & Band covering human visual range. \\ +\code{\defn{SANE_FRAME_RGB}} & 1 & Pixel-interleaved red/green/blue bands. \\ +\code{\defn{SANE_FRAME_RED}} & 2 & Red band of a red/green/blue image. \\ +\code{\defn{SANE_FRAME_GREEN}} & 3 & Green band of a red/green/blue image. \\ +\code{\defn{SANE_FRAME_BLUE}} & 4 & Blue band of a red/green/blue image. \\ \hline \end{tabular} - \caption{Frame Format (\code{SANE\_Frame})} + \caption{Frame Format (\code{SANE_Frame})} \label{tab:frameformat} \end{center} \end{table} -Member \code{last\_frame} is set to \code{SANE\_TRUE} if and only if +Member \code{last_frame} is set to \code{SANE_TRUE} if and only if the frame that is currently being acquired (or the frame that will be acquired next if there is no current frame) is the last frame of a multi frame image (e.g., the current frame is the blue component of a @@ -1419,22 +1419,22 @@ red, green, blue image). Member \code{lines} specifies how many scan lines the frame is comprised of. If this value is -1, the number of lines is not known a -priori and the frontend should call \code{sane\_read()} until it -returns a status of \code{SANE\_STATUS\_EOF}. +priori and the frontend should call \code{sane_read()} until it +returns a status of \code{SANE_STATUS_EOF}. -Member \code{bytes\_per\_line} specifies the number of bytes that +Member \code{bytes_per_line} specifies the number of bytes that comprise one scan line. Member \code{depth} specifies the number of bits per sample. -Member \code{pixels\_per\_line} specifies the number of pixels that +Member \code{pixels_per_line} specifies the number of pixels that comprise one scan line. Assume $B$ is the number of channels in the frame, then the bit depth $d$ (as given by member \code{depth}) and the number of pixels per -line $n$ (as given by this member \code{pixels\_per\_line}) are +line $n$ (as given by this member \code{pixels_per_line}) are related to $c$, the number of bytes per line (as given by member -\code{bytes\_per\_line}) as follows: +\code{bytes_per_line}) as follows: \[ c >= \left\{ \begin{array}{ll} @@ -1448,11 +1448,11 @@ value imposed by the right side of this equation. A frontend must be able to properly cope with such ``padded'' image formats. -\subsection{\code{sane\_start}} +\subsection{\code{sane_start}} This function initiates aquisition of an image from the device represented by handle \code{h}. -\begin{quote}\index{sane\_start} +\begin{quote}\index{sane_start} \begin{verbatim} SANE_Status sane_start (SANE_Handle h); \end{verbatim} @@ -1460,33 +1460,33 @@ SANE_Status sane_start (SANE_Handle h); This function may fail with one of the following status codes. \begin{quote} \begin{description} -\item[\code{SANE\_STATUS\_CANCELLED}:] The operation was cancelled through - a call to \code{sane\_cancel}. -\item[\code{SANE\_STATUS\_DEVICE\_BUSY}:] The device is busy. The +\item[\code{SANE_STATUS_CANCELLED}:] The operation was cancelled through + a call to \code{sane_cancel}. +\item[\code{SANE_STATUS_DEVICE_BUSY}:] The device is busy. The operation should be retried later. -\item[\code{SANE\_STATUS\_JAMMED}:] The document feeder is jammed. -\item[\code{SANE\_STATUS\_NO\_DOCS}:] The document feeder is out of +\item[\code{SANE_STATUS_JAMMED}:] The document feeder is jammed. +\item[\code{SANE_STATUS_NO_DOCS}:] The document feeder is out of documents. -\item[\code{SANE\_STATUS\_COVER\_OPEN}:] The scanner cover is open. -\item[\code{SANE\_STATUS\_IO\_ERROR}:] An error occurred while communicating +\item[\code{SANE_STATUS_COVER_OPEN}:] The scanner cover is open. +\item[\code{SANE_STATUS_IO_ERROR}:] An error occurred while communicating with the device. -\item[\code{SANE\_STATUS\_NO\_MEM}:] An insufficent amount of memory +\item[\code{SANE_STATUS_NO_MEM}:] An insufficent amount of memory is available. \end{description} \end{quote} -\subsection{\code{sane\_read}} +\subsection{\code{sane_read}} This function is used to read image data from the device represented by handle \code{h}. Argument \code{buf} is a pointer to a memory area that is at least \code{maxlen} bytes long. The number of bytes returned is stored in \code{*len}. A backend must set this to zero when the call fails (i.e., when a status other than -\code{SANE\_STA\-TUS\_GOOD} is returned). When the call succeeds, the +\code{SANE_STATUS_GOOD} is returned). When the call succeeds, the number of bytes returned can be anywhere in the range from 0 to \code{maxlen} bytes. -\begin{quote}\index{sane\_read} +\begin{quote}\index{sane_read} \begin{verbatim} SANE_Status sane_read (SANE_Handle h, SANE_Byte * buf, SANE_Int maxlen, SANE_Int * len); @@ -1501,39 +1501,39 @@ handle \code{h}. error occurs). \item If the device is in non-blocking I/O mode, the call returns - immediately with status \code{SANE\_STA\-TUS\_GOOD} and with + immediately with status \code{SANE_STATUS_GOOD} and with \code{*len} set to zero. \end{enumerate} The I/O mode of handle \code{h} can be set via a call to -\code{sane\_set\_io\_mode()}. +\code{sane_set_io_mode()}. This function may fail with one of the following status codes. \begin{quote} \begin{description} -\item[\code{SANE\_STATUS\_CANCELLED}:] The operation was cancelled through - a call to \code{sane\_cancel}. -\item[\code{SANE\_STATUS\_EOF}:] No more data is available for the +\item[\code{SANE_STATUS_CANCELLED}:] The operation was cancelled through + a call to \code{sane_cancel}. +\item[\code{SANE_STATUS_EOF}:] No more data is available for the current frame. -\item[\code{SANE\_STATUS\_JAMMED}:] The document feeder is jammed. -\item[\code{SANE\_STATUS\_NO\_DOCS}:] The document feeder is out of +\item[\code{SANE_STATUS_JAMMED}:] The document feeder is jammed. +\item[\code{SANE_STATUS_NO_DOCS}:] The document feeder is out of documents. -\item[\code{SANE\_STATUS\_COVER\_OPEN}:] The scanner cover is open. -\item[\code{SANE\_STATUS\_IO\_ERROR}:] An error occurred while communicating +\item[\code{SANE_STATUS_COVER_OPEN}:] The scanner cover is open. +\item[\code{SANE_STATUS_IO_ERROR}:] An error occurred while communicating with the device. -\item[\code{SANE\_STATUS\_NO\_MEM}:] An insufficent amount of memory +\item[\code{SANE_STATUS_NO_MEM}:] An insufficent amount of memory is available. -\item[\code{SANE\_STATUS\_ACCESS\_DENIED}:] Access to the device has +\item[\code{SANE_STATUS_ACCESS_DENIED}:] Access to the device has been denied due to insufficient or invalid authentication. \end{description} \end{quote} -\subsection{\code{sane\_cancel}} +\subsection{\code{sane_cancel}} This function is used to immediately or as quickly as possible cancel the currently pending operation of the device represented by handle \code{h}. -\begin{quote}\index{sane\_cancel} +\begin{quote}\index{sane_cancel} \begin{verbatim} void sane_cancel (SANE_Handle h); \end{verbatim} @@ -1546,66 +1546,66 @@ to note that completion of this operaton does {\em not\/} imply that the currently pending operation has been cancelled. It only guarantees that cancellation has been {\em initiated}. Cancellation completes only when the cancelled call returns (typically with a -status value of \code{SANE\_STATUS\_CANCELLED}). Since the SANE API +status value of \code{SANE_STATUS_CANCELLED}). Since the SANE API does not require any other operations to be re-entrant, this implies that a frontend must {\em not\/} call any other operation until the cancelled operation has returned. -\subsection{\code{sane\_set\_io\_mode}} +\subsection{\code{sane_set_io_mode}} This function is used to set the I/O mode of handle \code{h}. The I/O mode can be either blocking or non-blocking. If argument \code{m} is -\code{SANE\_TRUE}, the mode is set to non-blocking mode, otherwise +\code{SANE_TRUE}, the mode is set to non-blocking mode, otherwise it's set to blocking mode. -\begin{quote}\index{sane\_set\_io\_mode} +\begin{quote}\index{sane_set_io_mode} \begin{verbatim} SANE_Status sane_set_io_mode (SANE_Handle h, SANE_Bool m); \end{verbatim} \end{quote} By default, newly opened handles operate in blocking mode. A backend may elect not to support non-blocking I/O mode. In such a case the -status value \code{SANE\_STATUS\_UNSUPPORTED} is returned. Blocking +status value \code{SANE_STATUS_UNSUPPORTED} is returned. Blocking I/O must be supported by all backends, so calling this function with -argument \code{m} set to \code{SANE\_FALSE} is guaranteed to complete +argument \code{m} set to \code{SANE_FALSE} is guaranteed to complete successfully. This function may fail with one of the following status codes: \begin{quote} \begin{description} -\item[\code{SANE\_STATUS\_INVAL}:] No image acquisition is pending. -\item[\code{SANE\_STATUS\_UNSUPPORTED}:] The backend does not support +\item[\code{SANE_STATUS_INVAL}:] No image acquisition is pending. +\item[\code{SANE_STATUS_UNSUPPORTED}:] The backend does not support this operation. \end{description} \end{quote} -\subsection{\code{sane\_get\_select\_fd}} +\subsection{\code{sane_get_select_fd}} This function is used to obtain a (platform-specific) file-descriptor for handle \code{h} that is readable if and only if image data is -available (i.e., when a call to \code{sane\_read()} will return at +available (i.e., when a call to \code{sane_read()} will return at least one byte of data). If the call completes successfully, the select file-descriptor is returned in \code{*fd}. -\begin{quote}\index{sane\_get\_select\_fd} +\begin{quote}\index{sane_get_select_fd} \begin{verbatim} SANE_Status sane_get_select_fd (SANE_Handle h, SANE_Int *fd); \end{verbatim} \end{quote} -This function can be called only after a call to \code{sane\_start()} +This function can be called only after a call to \code{sane_start()} has been performed and the returned file-descriptor is guaranteed to remain valid for the duration of the current image acquisition (i.e., -until \code{sane\_cancel()} or \code{sane\_start()} get called again -or until \code{sane\_read()} returns with status -\code{SANE\_STA\-TUS\_EOF}). Indeed, a backend must guarantee to +until \code{sane_cancel()} or \code{sane_start()} get called again +or until \code{sane_read()} returns with status +\code{SANE_STATUS_EOF}). Indeed, a backend must guarantee to close the returned select file descriptor at the point when the next -\code{sane\_read()} call would return \code{SANE\_STA\-TUS\_EOF}. +\code{sane_read()} call would return \code{SANE_STATUS_EOF}. This is necessary to ensure the application can detect when this -condition occurs without actually having to call \code{sane\_read()}. +condition occurs without actually having to call \code{sane_read()}. A backend may elect not to support this operation. In such a case, the function returns with status code -\code{SANE\_STATUS\_UNSUPPORTED}. +\code{SANE_STATUS_UNSUPPORTED}. Note that the only operation supported by the returned file-descriptor is a host operating-system dependent test whether the file-descriptor @@ -1613,7 +1613,7 @@ is readable (e.g., this test can be implemented using \code{select()} or \code{poll()} under UNIX). If any other operation is performed on the file descriptor, the behavior of the backend becomes unpredictable. Once the file-descriptor signals ``readable'' status, -it will remain in that state until a call to \code{sane\_read()} is +it will remain in that state until a call to \code{sane_read()} is performed. Since many input devices are very slow, support for this operation is strongly encouraged as it permits an application to do other work while image acquisition is in progress. @@ -1621,14 +1621,14 @@ other work while image acquisition is in progress. This function may fail with one of the following status codes: \begin{quote} \begin{description} -\item[\code{SANE\_STATUS\_INVAL}:] No image acquisition is pending. -\item[\code{SANE\_STATUS\_UNSUPPORTED}:] The backend does not support +\item[\code{SANE_STATUS_INVAL}:] No image acquisition is pending. +\item[\code{SANE_STATUS_UNSUPPORTED}:] The backend does not support this operation. \end{description} \end{quote} -\subsection{\code{sane\_strstatus}} +\subsection{\code{sane_strstatus}} This function can be used to translate a SANE status code into a printable string. The returned string is a single line of text that @@ -1636,7 +1636,7 @@ forms a complete sentence, but without the trailing period (full-stop). The function is guaranteed to never return \code{NULL}. The returned pointer is valid at least until the next call to this function is performed. -\begin{quote}\index{sane\_strstatus} +\begin{quote}\index{sane_strstatus} \begin{verbatim} const SANE_String_Const sane_strstatus (SANE_Status status); \end{verbatim} @@ -1645,8 +1645,8 @@ const SANE_String_Const sane_strstatus (SANE_Status status); \section{Code Flow}\index{code flow} The code flow for the SANE API is illustrated in -Figure~\ref{fig:flow}. Functions \code{sane\_init()} and -\code{sane\_exit()} initialize and exit the backend, respectively. +Figure~\ref{fig:flow}. Functions \code{sane_init()} and +\code{sane_exit()} initialize and exit the backend, respectively. All other calls must be performed after initialization and before exiting the backend. @@ -1659,8 +1659,8 @@ exiting the backend. \end{center} \end{figure} -Function \code{sane\_get\_devices()} can be called any time after -\code{sane\_init()} has been called. It returns the list of the +Function \code{sane_get_devices()} can be called any time after +\code{sane_init()} has been called. It returns the list of the devices that are known at the time of the call. This list may change over time since some devices may be turned on or off or a remote host may boot or shutdown between different calls. It should be noted that @@ -1670,13 +1670,13 @@ may therefore want to provide the ability for a user to directly select a desired device without requiring a call to this function. Once a device has been chosen, it is opened using a call to -\code{sane\_open()}. Multiple devices can be open at any given time. +\code{sane_open()}. Multiple devices can be open at any given time. A SANE backend must not impose artificial constraints on how many devices can be open at any given time. An opened device can be setup through the corresponding device handle -using functions \code{sane\_get\_opt\-ion\_desc\-riptor()} and -\code{sane\_control\_option()}. While setting up a device, obtaining +using functions \code{sane_get_option_descriptor()} and +\code{sane_control_option()}. While setting up a device, obtaining option descriptors and setting and reading of option values can be mixed freely. It is typical for a frontend to read out all available options at the beginning and then build a dialog (either graphical or @@ -1686,41 +1686,41 @@ fixed for a given handle. However, as options are set, other options may become active or inactive. Thus, after setting an option, it maybe necessary to re-read some or all option descriptors. While setting up the device, it is also admissible to call -\code{sane\_get\_parameters()} to get an estimate of what the image +\code{sane_get_parameters()} to get an estimate of what the image parameters will look like once image acquisition begins. The device handle can be put in blocking or non-blocking mode by a -call to \code{sane\_set\_io\_mode()}. Devices are required to support +call to \code{sane_set_io_mode()}. Devices are required to support blocking mode (which is the default mode), but support for non-blocking I/O is strongly encouraged for operating systems such as UNIX. After the device is setup properly, image acquisition can be started -by a call to \code{sane\_start()}. The backend calculates the exact +by a call to \code{sane_start()}. The backend calculates the exact image parameters at this point. So future calls to -\code{sane\_get\_parameters()} will return the exact values, rather +\code{sane_get_parameters()} will return the exact values, rather than estimates. Whether the physical image acquisition starts at this -point or during the first call to \code{sane\_read()} is unspecified +point or during the first call to \code{sane_read()} is unspecified by the SANE API. If non-blocking I/O and/or a select-style interface is desired, the frontend may attempt to call -\code{sane\_set\_io\_mode()} and/or \code{sane\_get\_select\_fd()} at +\code{sane_set_io_mode()} and/or \code{sane_get_select_fd()} at this point. Either of these functions may fail if the backend does not support the requested operation. -Image data is collected by repeatedly calling \code{sane\_read()}. +Image data is collected by repeatedly calling \code{sane_read()}. Eventually, this function will return an end-of-file status -(\code{SANE\_STATUS\_EOF}). This indicates the end of the current +(\code{SANE_STATUS_EOF}). This indicates the end of the current frame. If the frontend expects additional frames (e.g., the individual channels in of a red/green/blue image or multiple images), -it can call \code{sane\_start()} again. Once all desired frames have -been acquired, function \code{sane\_cancel()} must be called. This +it can call \code{sane_start()} again. Once all desired frames have +been acquired, function \code{sane_cancel()} must be called. This operation can also be called at any other time to cancel a pending -operation. Note that \code{sane\_cancel()} must be called even if the -last read operation returned \code{SANE\_STATUS\_EOF}. +operation. Note that \code{sane_cancel()} must be called even if the +last read operation returned \code{SANE_STATUS_EOF}. When done using the device, the handle should be closed by a call to -\code{sane\_close()}. Finally, before exiting the application, -function \code{sane\_exit()} must be called. It is important not to +\code{sane_close()}. Finally, before exiting the application, +function \code{sane_exit()} must be called. It is important not to forget to call this function since otherwise some resources (e.g., temporary files or locks) may remain unclaimed. @@ -1742,20 +1742,20 @@ well-defined meanings. \subsection{Option Number Count}\index{option count} Option number 0 has an empty string as its name. The value of this -option is of type \code{SANE\_TYPE\_INT} and it specifies the total +option is of type \code{SANE_TYPE_INT} and it specifies the total number of options available for a given device (the count includes option number 0). This means that there are two ways of counting the number of options available: a frontend can either cycle through all option numbers starting at one until -\code{sane\_get\_option\_descriptor()} returns \code{NULL}, or a +\code{sane_get_option_descriptor()} returns \code{NULL}, or a frontend can directly read out the value of option number 0. \subsection{Scan Resolution Option}\index{scan resolution}\index{resolution option} Option \code{resolution} is used to select the resolution at which an image should be acquired. The type of this option is either -\code{SANE\_TYPE\_INT} or \code{SANE\_TYPE\_FIXED}. The unit is -\code{SANE\_UNIT\_DPI} (dots/inch). +\code{SANE_TYPE_INT} or \code{SANE_TYPE_FIXED}. The unit is +\code{SANE_UNIT_DPI} (dots/inch). This option is not mandatory, but if a backend does support it, it must implement it in a manner consistent with the above definition. @@ -1764,8 +1764,8 @@ must implement it in a manner consistent with the above definition. The boolean option \code{preview} is used by a frontend to inform the backend when image acquisition should be optimized for speed, rather -than quality (``preview mode''). When set to \code{SANE\_TRUE}, -preview mode is in effect, when set to \code{SANE\_FALSE} image +than quality (``preview mode''). When set to \code{SANE_TRUE}, +preview mode is in effect, when set to \code{SANE_FALSE} image acquisition should proceed in normal quality mode. The setting of this option \emph{must not\/} affect any other option. That is, as far as the other options are concerned, the preview mode is completely @@ -1818,7 +1818,7 @@ regarding these options: \begin{itemize} \item Backends must attach a unit of either pixels - (\code{SANE\_UNIT\_PIXEL}) or millimeters (\code{SANE\_UNIT\_MM}) to + (\code{SANE_UNIT_PIXEL}) or millimeters (\code{SANE_UNIT_MM}) to these options. The unit of all four options must be identical. \item Whenever meaningful, a backend should attach a range or a @@ -1835,7 +1835,7 @@ regarding these options: \end{itemize} -\input{net.tex} +\incl{net.tex} \chapter{Contact Information}\label{chap:contact}