libfo-version

libfo-version — libfo version checking

Synopsis

#define             LIBFO_VERSION_MAJOR
#define             LIBFO_VERSION_MINOR
#define             LIBFO_VERSION_MICRO
#define             LIBFO_VERSION_STRING
#define             LIBFO_VERSION_EXTRA
#define             LIBFO_PIXELS_PER_INCH
#define             LIBFO_VERSION_ENCODE                (major, minor, micro)
#define             LIBFO_VERSION
#define             LIBFO_VERSION_CHECK                 (major,minor,micro)
int                 libfo_version                       (void);
const char*         libfo_version_string                (void);
const char*         libfo_version_check                 (int required_major,
                                                         int required_minor,
                                                         int required_micro);
int                 libfo_pixels_per_inch               (void);
enum                LibfoModuleEnum;
                    LibfoVersionInfo;
const LibfoVersionInfo** libfo_version_get_info         (void);

Description

The capital-letter macros defined here can be used to check the version of libfo at compile-time, and to encode libfo versions into integers. The functions can be used to check the version of the linked libfo library at run-time.

Details

LIBFO_VERSION_MAJOR

#define LIBFO_VERSION_MAJOR 0

The major component of the version of libfo available at compile-time.


LIBFO_VERSION_MINOR

#define LIBFO_VERSION_MINOR 6

The minor component of the version of libfo available at compile-time.


LIBFO_VERSION_MICRO

#define LIBFO_VERSION_MICRO 2

The micro component of the version of libfo available at compile-time.


LIBFO_VERSION_STRING

#define LIBFO_VERSION_STRING "0.6.2"

A string literal containing the version of libfo available at compile-time.


LIBFO_VERSION_EXTRA

#define LIBFO_VERSION_EXTRA "-SVN541"

Extra compile-time version information string literal containing, e.g., the Subversion changeset number.


LIBFO_PIXELS_PER_INCH

#define LIBFO_PIXELS_PER_INCH 96

Pixels per inch for use with graphics without intrinsic size.


LIBFO_VERSION_ENCODE()

#define             LIBFO_VERSION_ENCODE(major, minor, micro)

This macro encodes the given libfo version into an integer. The numbers returned by LIBFO_VERSION and libfo_version() are encoded using this macro. Two encoded version numbers can be compared as integers.

major :

the major component of the version number

minor :

the minor component of the version number

micro :

the micro component of the version number

LIBFO_VERSION

#define             LIBFO_VERSION

The version of libfo available at compile-time, encoded using LIBFO_VERSION_ENCODE().


LIBFO_VERSION_CHECK()

#define             LIBFO_VERSION_CHECK(major,minor,micro)

Checks that the version of libfo available at compile-time is not older than the provided version number.

major :

the major component of the version number

minor :

the minor component of the version number

micro :

the micro component of the version number

libfo_version ()

int                 libfo_version                       (void);

This is similar to the macro LIBFO_VERSION except that it returns the encoded version of libfo available at run-time, as opposed to the version available at compile-time.

A version number can be encoded into an integer using LIBFO_VERSION_ENCODE().

Returns :

value: The encoded version of libfo library available at run time.

libfo_version_string ()

const char*         libfo_version_string                (void);

This is similar to the macro LIBFO_VERSION_STRING except that it returns the version of libfo available at run-time, as opposed to the version available at compile-time.

Returns :

value: A string containing the version of libfo library available at run time. The returned string is owned by libfo and should not be modified or freed.

libfo_version_check ()

const char*         libfo_version_check                 (int required_major,
                                                         int required_minor,
                                                         int required_micro);

Checks that the libfo library in use is compatible with the given version. Generally you would pass in the constants LIBFO_VERSION_MAJOR, LIBFO_VERSION_MINOR, LIBFO_VERSION_MICRO as the three arguments to this function; that produces a check that the library in use at run-time is compatible with the version of libfo the application or module was compiled against.

Compatibility is defined by two things: first the version of the running library is newer than the version required_major.required_minor.required_micro. Second the running library must be binary compatible with the version required_major.required_minor.required_micro (same major version.)

For compile-time version checking use LIBFO_VERSION_CHECK().

required_major :

the required major version.

required_minor :

the required minor version.

required_micro :

the required major version.

Returns :

NULL if the libfo library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by libfo and should not be modified or freed.

libfo_pixels_per_inch ()

int                 libfo_pixels_per_inch               (void);

This is similar to the macro LIBFO_PIXELS_PER_INCH except that it returns the encoded pixels per inch of libfo available at run-time, as opposed to the pixels per inch available at compile-time.

Returns :

value: The encoded pixels per inch of libfo library available at run time.

enum LibfoModuleEnum

typedef enum {
  LIBFO_MODULE_INVALID,
  LIBFO_MODULE_XSL_FORMATTER,
  LIBFO_MODULE_XSLT_PROCESSOR,
  LIBFO_MODULE_XML_DOC,
  LIBFO_MODULE_BACKEND,
  LIBFO_MODULE_PANGO
} LibfoModuleEnum;

The type of a module of libfo.

LIBFO_MODULE_INVALID

Not a module

LIBFO_MODULE_XSL_FORMATTER

XSL formatter

LIBFO_MODULE_XSLT_PROCESSOR

XSLT processor

LIBFO_MODULE_XML_DOC

LIBFO_MODULE_BACKEND

Backend

LIBFO_MODULE_PANGO

Pango

LibfoVersionInfo

typedef struct {
  LibfoModuleEnum module;
  const gchar    *nick;
  const gchar    *name;
  gint            compiled;
  const gchar    *compiled_string;
  gint            runtime;
  const gchar    *runtime_string;
} LibfoVersionInfo;

Collected version information about a component of libfo.

Other than nick, one or more of the parts of the LibfoVersionInfo may be 0 or NULL if the component is unable to report that information.

LibfoModuleEnum module;

Type of the module

const gchar *nick;

Nickname

const gchar *name;

FoObject type name, e.g., FoDocCairo

gint compiled;

Compiled version number

const gchar *compiled_string;

Compiled version number string

gint runtime;

Runtime version number

const gchar *runtime_string;

Runtime version number string

libfo_version_get_info ()

const LibfoVersionInfo** libfo_version_get_info         (void);

Gets the LibfoVersionInfo of libfo components.

Returns :

Array of pointers to LibfoVersionInfo. The last item is NULL.