diff --git a/tools/sane-desc.c b/tools/sane-desc.c index 0a9b14137..22693ed2e 100644 --- a/tools/sane-desc.c +++ b/tools/sane-desc.c @@ -21,15 +21,15 @@ MA 02111-1307, USA. */ -#define SANE_DESC_VERSION "0.7" +#define SANE_DESC_VERSION "0.8" #define MAN_PAGE_LINK "http://www.mostang.com/sane/man/%s.5.html" -#define COLOR_ALPHA "#B00000" -#define COLOR_BETA "#B0B000" -#define COLOR_STABLE "#008000" -#define COLOR_UNTESTED "#0000B0" -#define COLOR_UNSUPPORTED "#F00000" -#define COLOR_NEW "#F00000" +#define COLOR_ALPHA "\"#B00000\"" +#define COLOR_BETA "\"#B0B000\"" +#define COLOR_STABLE "\"#008000\"" +#define COLOR_UNTESTED "\"#0000B0\"" +#define COLOR_UNSUPPORTED "\"#F00000\"" +#define COLOR_NEW "\"#F00000\"" #include <../include/sane/config.h> @@ -48,6 +48,7 @@ #include #include "../include/sane/sane.h" +#include "../include/sane/sanei.h" #include "../include/sane/sanei_config.h" #ifndef PATH_MAX @@ -64,6 +65,7 @@ typedef enum output_mode { output_mode_ascii = 0, output_mode_html_backends, + output_mode_html_backends_split, output_mode_html_mfgs } output_mode; @@ -238,8 +240,9 @@ print_usage (char *program_name) program_name); printf (" -s|--search-dir dir Specify the directory that contains " ".desc files\n"); - printf (" -m|--mode mode Output mode (ascii, html-backends, " - "html-mfgs)\n"); + printf + (" -m|--mode mode Output mode (ascii, html-backends-split,\n" + " html-backends, html-mfgs)\n"); printf (" -t|--title \"title\" The title used for HTML pages\n"); printf (" -i|--intro \"intro\" A short description of the " "contents of the page\n"); @@ -306,6 +309,11 @@ get_options (int argc, char **argv) DBG_INFO ("Output mode: html-backends\n"); mode = output_mode_html_backends; } + else if (strcmp (optarg, "html-backends-split") == 0) + { + DBG_INFO ("Output mode: html-backends-split\n"); + mode = output_mode_html_backends_split; + } else if (strcmp (optarg, "html-mfgs") == 0) { DBG_INFO ("Output mode: html-mfgs\n"); @@ -1214,6 +1222,11 @@ sort_by_mfg (device_type dev_type) } /* while (be) */ DBG_DBG ("sort_by_mfg: Sorting manufacturers\n"); + if (!first_mfg_record) + { + DBG_DBG ("sort_by_mfg: no manufacturers found\n"); + return 0; + } do { /* bubblesort for manufacturers */ changed = SANE_FALSE; @@ -1222,6 +1235,7 @@ sort_by_mfg (device_type dev_type) next_mfg_record = first_mfg_record->next; while (mfg_record->next) { + DBG_DBG("%s, %s\n", mfg_record->name, mfg_record->next->name); if (strcasecmp (mfg_record->name, mfg_record->next->name) > 0) { mfg_record_entry *a = mfg_record, *b = mfg_record->next, @@ -1234,6 +1248,8 @@ sort_by_mfg (device_type dev_type) mfg_record->next = a; a->next = c; changed = SANE_TRUE; + DBG_DBG("chnaged: %s, %s\n", mfg_record->name, + mfg_record->next->name); } last_mfg_record = mfg_record; mfg_record = mfg_record->next; @@ -1589,16 +1605,16 @@ html_backends_table (device_type dev_type) } while (mfg) { - int num_models = 0; - model = mfg->model; - while (model) /* count models for rowspan */ - { - model = model->next; - num_models++; - } - if (num_models > 0) + if (model) { + int num_models = 0; + + while (model) /* count models for rowspan */ + { + model = model->next; + num_models++; + } model = mfg->model; if (mfg != type->mfg) printf ("\n"); @@ -1680,6 +1696,241 @@ html_backends_table (device_type dev_type) printf ("\n"); } +static void +html_backends_split_table (device_type dev_type) +{ + backend_entry *be = first_backend; + SANE_Bool first = SANE_TRUE; + + printf ("

Backends: \n"); + while (be) /* print link list */ + { + type_entry *type = be->type; + SANE_Bool found = SANE_FALSE; + + while (type) + { + if (type->type == dev_type) + found = SANE_TRUE; + type = type->next; + } + if (found) + { + if (!first) + printf (", \n"); + first = SANE_FALSE; + printf ("%s", + html_generate_anchor_name (be->name), be->name); + } + be = be->next; + } + be = first_backend; + if (first) + printf ("(none)\n"); + + printf ("

\n"); + + + while (be) + { + type_entry *type = be->type; + + while (type) + { + if (type->type == dev_type) + { + mfg_entry *mfg = type->mfg; + model_entry *model = mfg->model; + + printf ("

Backend: %s\n", + html_generate_anchor_name (be->name), be->name); + + if (be->version || be->new) + { + printf ("("); + if (be->version) + { + printf ("v%s", be->version); + if (be->new) + printf (", NEW!"); + } + else + printf ("NEW!"); + printf (")\n"); + } + printf ("

\n"); + + printf ("

\n"); + + if (be->url && be->url->name) + { + url_entry *url = be->url; + printf ("Link(s): \n"); + while (url) + { + if (url != be->url) + printf (", "); + printf ("%s", url->name, url->name); + url = url->next; + } + printf ("
\n"); + } + if (be->manpage) + printf ("Manual page: %s
\n", be->manpage, be->manpage); + + if (be->comment) + printf ("Comment: %s
\n", be->comment); + + if (type->desc) + { + printf ("Status: \n"); + switch (be->status) + { + case status_alpha: + printf ("alpha"); + break; + case status_beta: + printf ("beta"); + break; + case status_stable: + printf ("stable"); + break; + default: + printf ("?"); + break; + } + printf ("
\n"); + + if (type->desc->desc) + { + if (type->desc->url && type->desc->url->name) + printf ("Description: " + "%s
\n", + type->desc->url->name, type->desc->desc); + else + printf ("Description: %s
\n", + type->desc->desc); + } + + if (type->desc->comment) + printf ("Comment: %s
\n", type->desc->comment); + printf ("

\n"); + type = type->next; + continue; + } + printf ("

\n"); + + if (!mfg) + { + type = type->next; + continue; + } + + printf ("\n"); + + printf ("\n"); + printf ("\n"); + printf ("\n"); + printf ("\n"); + printf ("\n"); + printf ("\n"); + printf ("\n"); + + mfg = type->mfg; + while (mfg) + { + model = mfg->model; + if (model) + { + int num_models = 0; + + while (model) /* count models for rowspan */ + { + model = model->next; + num_models++; + } + model = mfg->model; + printf ("\n"); + printf ("\n"); + + if (model->url && model->url->name) + printf + ("\n", + model->url->name, model->name); + else + printf ("\n", + model->name); + + if (model->interface) + printf ("\n", + model->interface); + else + printf ("\n"); + + printf ("\n"); + + if (model->comment && model->comment[0] != 0) + printf ("\n", model->comment); + else + printf ("\n"); + + model = model->next; + printf ("\n"); + } /* while (model) */ + } /* if (num_models) */ + mfg = mfg->next; + } /* while (mfg) */ + } /* if (type->type) */ + printf ("
ManufacturerModelInterfaceStatusComment
\n", num_models); + if (mfg->url && mfg->url->name) + printf ("%s\n", mfg->url->name, + mfg->name); + else + printf ("%s\n", mfg->name); + + while (model) + { + enum status_entry status = model->status; + + if (model != mfg->model) + printf ("
%s%s%s?"); + if (status == status_unknown) + status = be->status; + switch (status) + { + case status_alpha: + printf ("alpha"); + break; + case status_beta: + printf ("beta"); + break; + case status_stable: + printf ("stable"); + break; + case status_untested: + printf ("untested"); + break; + case status_unsupported: + printf ("unsupported"); + break; + default: + printf ("?"); + break; + } + printf ("%s 
\n"); + type = type->next; + } /* while (type) */ + be = be->next; + } /* while (be) */ + printf ("\n"); +} + static void html_mfgs_table (device_type dev_type) @@ -1698,20 +1949,21 @@ html_mfgs_table (device_type dev_type) html_generate_anchor_name (mfg_record->name), mfg_record->name); mfg_record = mfg_record->next; } - printf ("

\n"); mfg_record = first_mfg_record; + if (!mfg_record) + printf ("(none)\n"); + printf ("

\n"); while (mfg_record) { backend_record_entry *be_record = mfg_record->be_record; printf ("

Manufacturer: %s

\n", html_generate_anchor_name (mfg_record->name), mfg_record->name); - if (mfg_record->comment) - printf ("

Comment: %s

\n", mfg_record->comment); + printf ("

\n"); if (mfg_record->url && mfg_record->url->name) { url_entry *url = mfg_record->url; - printf ("

Link(s): \n"); + printf ("Link(s): \n"); while (url) { if (url != mfg_record->url) @@ -1719,9 +1971,16 @@ html_mfgs_table (device_type dev_type) printf ("%s", url->name, url->name); url = url->next; } - printf ("

\n"); + printf ("
\n"); + } + if (mfg_record->comment) + printf ("Comment: %s
\n", mfg_record->comment); + printf ("

\n"); + if (!be_record || !be_record->model) + { + mfg_record = mfg_record->next; + continue; } - printf ("\n"); printf ("\n"); @@ -1864,7 +2123,7 @@ html_print_header (void) "still cameras,\n" "video cameras,\n" "APIs, and\n" - "meta backends\n"); + "meta backends.\n"); } static void @@ -1939,7 +2198,7 @@ html_print_backends (void) "
Supported Devices (for hardware devices):
\n" "
Which hardware the backend supports.
\n" "
Manufacturer:
\n" - "
Manufacturer, Vendor or brand name of the device.
\n" + "
Manufacturer, vendor or brand name of the device.
\n" "
Model:
\n" "
Name of the the device.
\n" "
Interface:
\n" @@ -1971,6 +2230,88 @@ html_print_backends (void) html_print_footer (); } +static void +html_print_backends_split (void) +{ + backend_entry *be; + + sort_by_backend (); + be = first_backend; + + if (!title) + title = "SANE: Backends (Drivers)"; + if (!intro) + intro = "

The following table summarizes the backends/drivers " + "distributed with the latest version of sane-backends, and the hardware " + "or software they support.

"; + + html_print_header (); + + printf ("

Scanners

\n"); + html_backends_split_table (type_scanner); + + printf ("

Still Cameras

\n"); + html_backends_split_table (type_stillcam); + + printf ("

Video Cameras

\n"); + html_backends_split_table (type_vidcam); + + printf ("

APIs

\n"); + html_backends_split_table (type_api); + + printf ("

Meta Backends

\n"); + html_backends_split_table (type_meta); + + printf + ("

Legend:

\n" + "
\n" + "
\n" + "
Backend:
\n" + "
Name of the backend, In parentheses if available:\n" + " Version of backend/driver; newer versions may be\n" + " available from their home sites.
" + " NEW! means brand-new to the\n" + " current release of SANE.\n" + "
\n" + "
Link(s):
\n" + "
Link(s) to more extensive and\n" + " detailed information, if it exists, or the email address\n" + " of the author or maintainer.\n" + "
Manual Page:
\n" + "
A link to the man-page on-line, if it exists.
\n" + "
Comment:
\n" + "
More information about the backend or model, e.g. the level of " + " support and possible problems.
\n" + "
Manufacturer:
\n" + "
Manufacturer, vendor or brand name of the device.
\n" + "
Model:
\n" + "
Name of the the device.
\n" + "
Interface:
\n" + "
How the device is connected to the computer.
\n" + "
Status:
\n" + "
A vague indication of robustness and reliability.\n" + "
  • unsupported" + " means the device is not supported at least by this backend. " + " It may be supported by other backends, however.\n" + "
  • untested means the " + " device may be supported but couldn't be tested. Be very " + " careful.\n" + "
  • alpha means it must\n" + " do something, but is not very well tested, probably has\n" + " bugs, and may even crash your system, etc., etc.\n" + "
  • beta means it works\n" + " pretty well, and looks stable and functional, but not\n" + " bullet-proof.\n" + "
  • stable means someone is\n" + " pulling your leg.\n" + "
\n" + "
Description:
\n" + "
The scope of application of the backend.\n" + "
\n" "
\n"); + + html_print_footer (); +} + static void html_print_mfgs (void) { @@ -1995,10 +2336,10 @@ html_print_mfgs (void) html_mfgs_table (type_vidcam); printf ("

APIs

\n"); - html_backends_table (type_api); + html_backends_split_table (type_api); printf ("

Meta Backends

\n"); - html_backends_table (type_meta); + html_backends_split_table (type_meta); printf ("

Legend:

\n" @@ -2068,6 +2409,9 @@ main (int argc, char **argv) case output_mode_html_backends: html_print_backends (); break; + case output_mode_html_backends_split: + html_print_backends_split (); + break; case output_mode_html_mfgs: html_print_mfgs (); break;