Ticket #123 (closed enhancement: fixed)

Opened 3 months ago

Last modified 2 weeks ago

The ability to query information from libfo

Reported by: incastrix Assigned to:
Priority: minor Milestone: xmlroff 0.6.0
Component: libfo Version: 0.5.x
Keywords: Cc:
Blocking:

Description

interesting to know libfo version, backend supported.

Change History

(follow-up: ↓ 2 ) 05/03/08 08:45:09 changed by tkg

How do you want to access the information? Separate function for each parameter? Associative array style lookup of value corresponding to parameter key?

Do you want to know the libxslt/libxml2 version as well?

What about the Subversion changeset number?

(in reply to: ↑ 1 ; follow-up: ↓ 3 ) 05/04/08 17:06:03 changed by incastrix

Replying to tkg:

How do you want to access the information? Separate function for each parameter? Associative array style lookup of value corresponding to parameter key?

Separate function, better interface.

Do you want to know the libxslt/libxml2 version as well?

yes, becouse someone could link to different version of these. For example have install packages and dev version (svn/cvs).

What about the Subversion changeset number?

yes, need it too.

(in reply to: ↑ 2 ; follow-up: ↓ 4 ) 06/05/08 20:55:02 changed by tkg

Replying to incastrix:

Replying to tkg:

How do you want to access the information? Separate function for each parameter? Associative array style lookup of value corresponding to parameter key?

Separate function, better interface.

Something like:

gchar * fo_libfo_version (void);
gchar * fo_libfo_libxslt_version (void);

?

(in reply to: ↑ 3 ; follow-up: ↓ 5 ) 06/05/08 22:10:10 changed by incastrix

Replying to tkg:

Replying to incastrix:

Replying to tkg:

How do you want to access the information? Separate function for each parameter? Associative array style lookup of value corresponding to parameter key?

Separate function, better interface.

Something like: {{{ gchar * fo_libfo_version (void); gchar * fo_libfo_libxslt_version (void); }}} ?

perfect

(in reply to: ↑ 4 ; follow-ups: ↓ 7 ↓ 10 ) 06/05/08 23:02:53 changed by tkg

Replying to incastrix:

Replying to tkg:

perfect

I'm glad that you didn't want:

void fo_libfo_version (gint *major, gint *minor, gint *micro, gint *subversion, gint *interface_age)

I do still worry that it won't be flexible enough if something changes in how libfo is put together.

And for backend support?

typedef enum
{
  FO_LIBFO_BACKEND_FLAG_NONE = 0,
  FO_LIBFO_BACKEND_FLAG_CAIRO = 1 << 0,
  FO_LIBFO_BACKEND_FLAG_GNOME_PRINT = 1 << 1,
  FO_LIBFO_BACKEND_FLAG_MASK = (1 << 2) - 1,
} FoLibfoBackendFlags;

FoLibfoBackendFlags fo_libfo_get_backends (void);

const gchar * fo_libfo_get_backend_version (FoLibfoBackendFlags backend);

?

(follow-up: ↓ 8 ) 06/05/08 23:04:25 changed by tkg

The other things that you might possibly need are Pango version and default pixels-per-inch for raster images.

(in reply to: ↑ 5 ) 06/05/08 23:17:56 changed by incastrix

Replying to tkg:

Replying to incastrix:

Replying to tkg:

perfect

I'm glad that you didn't want: void fo_libfo_version (gint *major, gint *minor, gint *micro, gint *subversion, gint *interface_age) I do still worry that it won't be flexible enough if something changes in how libfo is put together. And for backend support? {{{ typedef enum { FO_LIBFO_BACKEND_FLAG_NONE = 0, FO_LIBFO_BACKEND_FLAG_CAIRO = 1 << 0, FO_LIBFO_BACKEND_FLAG_GNOME_PRINT = 1 << 1, FO_LIBFO_BACKEND_FLAG_MASK = (1 << 2) - 1, } FoLibfoBackendFlags?; FoLibfoBackendFlags? fo_libfo_get_backends (void); const gchar * fo_libfo_get_backend_version (FoLibfoBackendFlags? backend); }}} ?

agree

(in reply to: ↑ 6 ; follow-up: ↓ 9 ) 06/05/08 23:19:11 changed by incastrix

Replying to tkg:

The other things that you might possibly need are Pango version and default pixels-per-inch for raster images.

Great!

IS possible to query backend ver?

(in reply to: ↑ 8 ; follow-up: ↓ 11 ) 06/06/08 06:31:18 changed by tkg

Replying to incastrix:

IS possible to query backend ver?

configure checks it to see if it's recent enough, so it should just be a matter of 'pkg-config --mod-version' leading to an #define in 'config.h'.

(in reply to: ↑ 5 ) 06/06/08 06:33:39 changed by tkg

Replying to tkg:

const gchar * fo_libfo_get_backend_version (FoLibfoBackendFlags? backend);

Does there also need to be:

const gchar * fo_libfo_get_backend_name (FoLibfoBackendFlags? backend);

(in reply to: ↑ 9 ) 06/06/08 09:03:55 changed by tkg

Replying to tkg:

configure checks it to see if it's recent enough, so it should just be a matter of 'pkg-config --mod-version' leading to an #define in 'config.h'.

That's not going to work for a dynamically linked library. It would have to use whatever API the backend provides for finding the version.

06/18/08 16:22:32 changed by tkg

(In [420]) First pass at adding version API. (Re #123.)

06/19/08 16:16:46 changed by tkg

(In [424]) Renamed FoEnumFormat? to FoFlagsFormat? so it could indicate multiple values. Added fo_doc_formats_from_name() for getting formats supported by a backend (re #123). Added some CUnit tests. Made xmlroff do case-insensitive matching on backend and format parameters.

06/20/08 20:04:09 changed by tkg

(In [425]) Added fo_doc_version_from_name() and fo_doc_version_string_from_name(). (Re #123.)

06/20/08 21:05:46 changed by tkg

[427] applied to this. It was not documentation updates.

06/20/08 21:14:22 changed by tkg

typedef struct {
  const gchar *nick;
  const gchar *name;
  gint         version;
  const gchar *version_string;
} LibfoVersionInfo;

const LibfoVersionInfo * libfo_version_backend_info (void);

isn't what I offered before, but would it do the job? (I am still working on it.)

06/26/08 15:05:23 changed by tkg

(In [429]) Backend runtime version info now available from libfo_version_backend_info(). (Re #123.)

06/28/08 10:42:38 changed by tkg

My current thought is something more like:

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

typedef struct {
  LibfoModuleEnum module;          /* Type of the module */
  const gchar    *nick;            /* Nickname for human consumption */
  const gchar    *name;            /* FoObject type name, e.g., FoDocCairo */
  gint            compiled;        /* Compile-time version number */
  const gchar    *compiled_string; /* Compile-time version number as string */
  gint            version;         /* Runtime version number */
  const gchar    *version_string;  /* Runtime version number as a string */
} LibfoVersionInfo;

const LibfoVersionInfo * libfo_version_get_info (void);

where libfo_version_get_info() returns an array of LibfoVersionInfo (where the last item is all NULLs and 0s), and you can pick over that to find the version information of the components of libfo.

There would, for example, be multiple LIBFO_MODULE_BACKEND entries when multiple backends are available.

It also means the API doesn't have to change if we come up with new components for libfo. (One day there will be loadable modules that can tweak the formatting, but we're still unfortunately a long way from that.)

I haven't quite worked out what it would mean for this function if, for example, the backends were loadable modules. I think the version API would have to report all that are available, even if it means loading them just long enough to get their version info.

I am ambivalent about providing the libxml2 version because that's not such an active part of libfo.

LIBFO_VERSION_MAJOR, etc., and libfo_version() would remain for use when all you really want to know is the libfo version.

07/04/08 22:25:46 changed by tkg

(In [433]) Next rendition of a version interface for libfo components. (Re #123.)

07/04/08 22:28:28 changed by tkg

libfo_version_get_info() returns an array of pointers to LibfoVersionInfo structs.

Currently only implemented for the two backends, and the CUnit test will fail if you don't have both backends enabled.

07/05/08 15:56:56 changed by tkg

(In [434]) Hopefully the final attempt at a version API. (Re #123.)

07/05/08 15:59:03 changed by tkg

I've done as much as I intend to do. Please see if it does enough for your purposes.

07/06/08 20:51:01 changed by tkg

  • milestone changed from Future to xmlroff 0.6.0.

07/07/08 11:42:32 changed by tkg

  • status changed from new to closed.
  • resolution set to fixed.