Next Up Previous Contents Index
Version Control

4.1 Version Control

The SANE standard is expected to evolve over time. Whenever a change to the SANE standard is made that may render an existing frontend or backend incompatible with the new standard, the major version number must be increased. Thus, any frontend/backend pair is compatible provided the major version number of the SANE standard they implement is the same. A frontend may implement backwards compatiblity by allowing major numbers that are smaller than the expected major number (provided the frontend really can cope with the older version). In contrast, a backend always provides support for one and only one version of the standard. If a specific application does require that two different versions of the same backend are accessible at the same time, it is possible to do so by installing the two versions under different names.

SANE version control also includes a minor version number and a build revision. While control of these numbers remains with the implementor of a backend, the recommended use is as follows. The minor version is incremented with each official release of a backend. The build revision is increased with each build of a backend.

The SANE API provides the following five macros to manage version numbers.

SANE_CURRENT_MAJOR:
The value of this macro is the number of the SANE standard that the interface implements.

SANE_VERSION_CODE(maj,min,bld):
This macro can be used to build a monotonically increasing version code. A SANE version code consists of the SANE standard major version number (maj), the minor version number min, and the build revision of a backend (bld). The major and minor version numbers must be in the range 0...255 and the build revision must be in the range 0...65535.

Version codes are monotonic in the sense that it is possible to apply relational operators (e.g., equality or less-than test) directly on the version code rather than individually on the three components of the version code.

Note that the major version number alone determines whether a frontend/backend pair is compatible. The minor version and the build revision are used for informational and bug-fixing purposes only.

SANE_VERSION_MAJOR(vc):
This macro returns the major version number component of the version code passed in argument vc.
SANE_VERSION_MINOR(vc):
This macro returns the minor version number component of the version code passed in argument vc.
SANE_VERSION_BUILD(vc):
This macro returns the build revision component of the version code passed in argument vc.


Next Up Previous Contents Index