From 39321aa87bbdee5713d7c45c3573f64d17c55b41 Mon Sep 17 00:00:00 2001 From: Henning Geinitz Date: Wed, 18 Jun 2003 09:06:38 +0000 Subject: [PATCH] Changed to use the new status system for devices: unsupported, untested, minimal, basic, good, complete. The old backend and device statuses are translated. Removed the option to generate one big table of backends (wasn't used anyway). --- ChangeLog | 8 + tools/sane-desc.c | 735 ++++++++++++++-------------------------------- 2 files changed, 232 insertions(+), 511 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1055a8734..d7526f6b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-06-15 Henning Meier-Geinitz + + * tools/sane-desc.c: Changed to use the new status system for + devices: unsupported, untested, minimal, basic, good, complete. + The old backend and device statuses are translated. Removed + the option to generate one big table of backends (wasn't used + anyway). + 2003-06-15 Henning Meier-Geinitz * README.darwin: Minor updates. diff --git a/tools/sane-desc.c b/tools/sane-desc.c index 1be9959bb..cc0a67ddb 100644 --- a/tools/sane-desc.c +++ b/tools/sane-desc.c @@ -21,15 +21,16 @@ MA 02111-1307, USA. */ -#define SANE_DESC_VERSION "1.1" +#define SANE_DESC_VERSION "2.0" #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_MINIMAL "\"#B00000\"" +#define COLOR_BASIC "\"#FF9000\"" +#define COLOR_GOOD "\"#90B000\"" +#define COLOR_COMPLETE "\"#007000\"" +#define COLOR_UNTESTED "\"#0000B0\"" +#define COLOR_UNSUPPORTED "\"#F00000\"" +#define COLOR_NEW "\"#F00000\"" #include <../include/sane/config.h> @@ -80,11 +81,12 @@ parameter_type; typedef enum status_entry { status_unknown, - status_alpha, - status_beta, - status_stable, status_untested, - status_unsupported + status_unsupported, + status_minimal, + status_basic, + status_good, + status_complete } status_entry; @@ -159,7 +161,7 @@ typedef struct backend_entry struct backend_entry *next; char *name; char *version; - enum status_entry status; + enum status_entry status; /* deprecated */ char *manpage; struct url_entry *url; char *comment; @@ -240,7 +242,7 @@ print_usage (char *program_name) ".desc files\n"); printf (" -m|--mode mode Output mode (ascii, html-backends-split,\n" - " html-backends, html-mfgs)\n"); + " 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"); @@ -302,11 +304,6 @@ get_options (int argc, char **argv) DBG_INFO ("Output mode: ascii\n"); mode = output_mode_ascii; } - else if (strcmp (optarg, "html-backends") == 0) - { - 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"); @@ -694,24 +691,24 @@ read_files (void) } else if (strcmp (string_entry, ":alpha") == 0) { - DBG_INFO - ("setting status of backend `%s' to `alpha'\n", + DBG_WARN + ("DEPRECATED backend status `alpha': setting status of backend `%s' to `basic'\n", current_backend->name); - current_backend->status = status_alpha; + current_backend->status = status_basic; } else if (strcmp (string_entry, ":beta") == 0) { - DBG_INFO - ("setting status of backend `%s' to `beta'\n", + DBG_WARN + ("DEPRECATED backend status `beta': setting status of backend `%s' to `good'\n", current_backend->name); - current_backend->status = status_beta; + current_backend->status = status_good; } else if (strcmp (string_entry, ":stable") == 0) { - DBG_INFO - ("setting status of backend `%s' to `stable'\n", + DBG_WARN + ("DEPRECATED backend status `stable': setting status of backend `%s' to `complete'\n", current_backend->name); - current_backend->status = status_stable; + current_backend->status = status_complete; } else { @@ -729,24 +726,52 @@ read_files (void) } if (strcmp (string_entry, ":alpha") == 0) { - DBG_INFO - ("setting status of model `%s' to `alpha'\n", + DBG_WARN + ("DEPRECATED status `alpha': setting status of model `%s' to `basic'\n", current_model->name); - current_model->status = status_alpha; + current_model->status = status_basic; } else if (strcmp (string_entry, ":beta") == 0) { - DBG_INFO - ("setting status of model `%s' to `beta'\n", + DBG_WARN + ("DEPRECATED status `beta': setting status of model `%s' to `good'\n", current_model->name); - current_model->status = status_beta; + current_model->status = status_good; } else if (strcmp (string_entry, ":stable") == 0) { - DBG_INFO - ("setting status of model `%s' to `stable'\n", + DBG_WARN + ("DEPRECATED status `stable': setting status of model `%s' to `complete'\n", current_model->name); - current_model->status = status_stable; + current_model->status = status_complete; + } + else if (strcmp (string_entry, ":minimal") == 0) + { + DBG_INFO + ("setting status of model `%s' to `minimal'\n", + current_model->name); + current_model->status = status_minimal; + } + else if (strcmp (string_entry, ":basic") == 0) + { + DBG_INFO + ("setting status of model `%s' to `basic'\n", + current_model->name); + current_model->status = status_basic; + } + else if (strcmp (string_entry, ":good") == 0) + { + DBG_INFO + ("setting status of model `%s' to `good'\n", + current_model->name); + current_model->status = status_good; + } + else if (strcmp (string_entry, ":complete") == 0) + { + DBG_INFO + ("setting status of model `%s' to `complete'\n", + current_model->name); + current_model->status = status_complete; } else if (strcmp (string_entry, ":untested") == 0) { @@ -766,10 +791,9 @@ read_files (void) { DBG_ERR ("unknown status of model `%s': `%s'\n", current_model->name, string_entry); - current_model->status = status_unknown; + current_model->status = status_untested; return SANE_FALSE; } - break; default: DBG_ERR ("level %d not implemented for :status\n", @@ -1142,7 +1166,7 @@ create_model_record (model_entry * model) } /* Calculate the priority of statuses: */ -/* alpha, beta, stable -> 2, untested -> 1, unsupported -> 0 */ +/* minimal, basic, good, complete -> 2, untested -> 1, unsupported -> 0 */ static int calc_priority (status_entry status) { @@ -1376,22 +1400,6 @@ ascii_print_backends (void) if (be->new) printf (" NEW!\n"); - switch (be->status) - { - case status_alpha: - printf (" status alpha\n"); - break; - case status_beta: - printf (" status beta\n"); - break; - case status_stable: - printf (" status stable\n"); - break; - default: - printf (" status *unknown*\n"); - break; - } - if (be->manpage) printf (" manpage `%s'\n", be->manpage); else @@ -1488,16 +1496,21 @@ ascii_print_backends (void) printf (" interface `%s'\n", model->interface); else printf (" interface *none*\n"); + if (model->status == status_unknown) + model->status = be->status; switch (model->status) { - case status_alpha: - printf (" status alpha\n"); + case status_minimal: + printf (" status minimal\n"); break; - case status_beta: - printf (" status beta\n"); + case status_basic: + printf (" status basic\n"); break; - case status_stable: - printf (" status stable\n"); + case status_good: + printf (" status good\n"); + break; + case status_complete: + printf (" status complete\n"); break; case status_untested: printf (" status untested\n"); @@ -1564,250 +1577,6 @@ html_generate_anchor_name (char *manufacturer_name) return name; } -/* Generate a table of all backends providing models of type dev_type */ -static void -html_backends_table (device_type dev_type) -{ - backend_entry *be = first_backend; - SANE_Bool found = SANE_FALSE; - - /* check if we have at least one matching backend */ - while (be) - { - type_entry *type = be->type; - - while (type) - { - if (type->type == dev_type) - found = SANE_TRUE; - type = type->next; - } - be = be->next; - } - if (!found) - { - printf ("

(none)

\n"); - return; - } - be = first_backend; - - printf ("\n"); - printf ("\n"); - - switch (dev_type) - { - case type_scanner: - case type_stillcam: - case type_vidcam: - printf ("\n"); - printf ("\n"); - printf ("\n"); - printf ("\n"); - printf ("\n"); - printf ("\n"); - printf ("\n"); - printf ("\n"); - printf ("\n"); - printf ("\n"); - break; - case type_meta: - case type_api: - printf ("\n"); - printf ("\n"); - printf ("\n"); - printf ("\n"); - printf ("\n"); - break; - default: - DBG_ERR ("Unknown device type (%d)\n", dev_type); - return; - } - - printf ("\n"); - - while (be) - { - type_entry *type = be->type; - - while (type) - { - if (type->type == dev_type) - { - mfg_entry *mfg = type->mfg; - model_entry *model; - int row_num = 0; - - /* count models for backend rowspan */ - if (mfg) /* scanner, camera */ - while (mfg) - { - model = mfg->model; - while (model) - { - model = model->next; - row_num++; - } - mfg = mfg->next; - } - else - row_num = 1; - - printf ("\n"); - if (be->manpage) - printf ("\n", row_num, be->manpage, - be->manpage); - else - printf ("\n", row_num); - - mfg = type->mfg; - if (!mfg && type->desc) - { - if (type->desc->desc) - { - if (type->desc->url && type->desc->url->name) - printf ("\n", - type->desc->url->name, type->desc->desc); - else - printf ("\n", type->desc->desc); - } - else - printf ("\n"); - printf ("\n"); - - if (type->desc->comment) - printf ("\n", type->desc->comment); - else - printf ("\n"); - printf ("\n"); - } - 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; - if (mfg != type->mfg) - 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) */ - type = type->next; - } /* while (type) */ - be = be->next; - } /* while (be) */ - printf ("
BackendManual PageSupported Devices
ManufacturerModelInterfaceStatusCommentBackendManual PageDescriptionStatusComment
\n", row_num); - if (be->url && be->url->name) - printf ("%s\n", be->url->name, be->name); - else - printf ("%s", 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 ("
%s?%s%s "); - 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 ("%s 
\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"); -} /* Generate one table per backend of all backends providing models */ /* of type dev_type */ @@ -1865,7 +1634,7 @@ html_backends_split_table (device_type dev_type) printf ("("); if (be->version) { - printf ("v%s", be->version); + printf ("%s", be->version); if (be->new) printf (", NEW!"); } @@ -1897,26 +1666,9 @@ html_backends_split_table (device_type dev_type) 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) @@ -1997,20 +1749,24 @@ html_backends_split_table (device_type dev_type) printf (""); if (status == status_unknown) - status = be->status; + status = be->status; switch (status) { - case status_alpha: - printf ("alpha"); + case status_minimal: + printf ("minimal"); break; - case status_beta: - printf ("beta"); + case status_basic: + printf ("basic"); break; - case status_stable: - printf ("stable"); + case status_good: + printf ("good"); + break; + case status_complete: + printf ("complete"); break; case status_untested: printf ("?\n"); printf (""); + if (status == status_unknown) status = model_record->be->status; + switch (status) { - case status_alpha: - printf ("alpha"); + case status_minimal: + printf ("minimal"); break; - case status_beta: - printf ("beta"); + case status_basic: + printf ("basic"); break; - case status_stable: - printf ("stable"); + case status_good: + printf ("good"); + break; + case status_complete: + printf ("complete"); break; case status_untested: printf ("untested"); @@ -2167,7 +1928,7 @@ html_mfgs_table (device_type dev_type) printf ("
("); if (model_record->be->version) { - printf ("v%s", model_record->be->version); + printf ("%s", model_record->be->version); if (model_record->be->new) printf (", NEW!"); } @@ -2223,10 +1984,10 @@ html_print_header (void) "href=\"mailto:jonathan@buzzard.org.uk\">\n" "Jonathan Buzzard.

\n"); printf - ("

If you have new information or corrections, please send\n" - "e-mail to sane-devel, the SANE mailing\n" - "list.

\n" + ("

If you have new information or corrections, please contact\n" + "henning@meier-geinitz.de\n" + "with as many details as possible. Also please contact me if your scanner \n" + "isn't mentioned in this list at all.

\n" "

For an explanation of the tables, see the\n" "legend.\n"); printf @@ -2256,88 +2017,108 @@ html_print_footer (void) printf (" \n"); } -/* Print the HTML page with one table of backends per type */ + +/* print parts of the legend */ static void -html_print_backends (void) +html_print_legend_backend (void) { - 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 ("

\n"); - - printf ("

Scanners

\n"); - html_backends_table (type_scanner); - - printf ("

Still Cameras

\n"); - html_backends_table (type_stillcam); - - printf ("

Video Cameras

\n"); - html_backends_table (type_vidcam); - - printf ("

APIs

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

Meta Backends

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

Legend:

\n" - "
\n" - "
\n" - "
Backend:
\n" - "
Name of the backend, with a link to more extensive and\n" - " detailed information, if it exists, or the email address\n" - " of the author or maintainer. In parentheses if available:\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"); + " current release of SANE.
\n" + " UNMAINTAINED means that nobody maintains that backend. Expect no \n" + " new features or newly supported devices. You are welcome to take over \n" + " maintainership.\n" + " \n"); +} + +static void +html_print_legend_link (void) +{ + printf + ("
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"); +} + +static void +html_print_legend_manual (void) +{ printf ("
Manual Page:
\n" - "
A link to the man-page on-line, if it exists.
\n" - "
Supported Devices (for hardware devices):
\n" - "
Which hardware the backend supports.
\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"); - printf - ("
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"); - printf - ("
  • 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"); + "
A link to the man-page online, if it exists.
\n"); +} + +static void +html_print_legend_comment (void) +{ printf ("
Comment:
\n" - "
More information about the level of support and\n" - " possible problems.
\n" - "
Description (for API and meta backends):
\n" - "
The scope of application of the backend.\n" - "
\n" "
\n"); + "
More information about the backend or model, e.g. the level of " + " support and possible problems.
\n"); +} - html_print_footer (); +static void +html_print_legend_manufacturer (void) +{ + printf + ("
Manufacturer:
\n" + "
Manufacturer, vendor or brand name of the device.
\n"); +} + +static void +html_print_legend_model (void) +{ + printf + ("
Model:
\n" + "
Name of the the device.
\n"); +} + +static void +html_print_legend_interface (void) +{ + printf + ("
Interface:
\n" + "
How the device is connected to the computer.
\n"); +} + +static void +html_print_legend_status (void) +{ + printf + ("
Status:
\n" + "
Indicates how many of the features the device provides \n" + " are supported by SANE.\n" + "
  • unsupported" + " means the device is not supported at least by this backend. " + " It may be supported by other backends, however.\n"); + printf + ("
  • untested means the " + " device may be supported but couldn't be tested. Be very " + " careful and report success/failure.\n" + "
  • minimal means that the\n" + " device is detected and scans at least in one mode. But the quality \n" + " is bad or important features won't work.\n"); + printf + ("
  • basic means it works at \n" + " least in the most important modes but quality is not perfect.\n" + "
  • good means the device is usable \n" + " for day-to-day work. Some rather exotic features may be missing.\n" + "
  • complete means the backends \n" + " supports everything the device can do.\n" + "
\n"); +} + +static void +html_print_legend_description (void) +{ + printf + ("
Description:
\n" + "
The scope of application of the backend.\n"); } /* Print the HTML page with one table of models per backend */ @@ -2368,56 +2149,20 @@ html_print_backends_split (void) 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"); - printf - ("
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"); - printf - ("
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"); - printf - ("
  • 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"); - printf - ("
  • 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"); - printf - ("
Description:
\n" - "
The scope of application of the backend.\n" - "
\n" "
\n"); + printf ("

Legend:

\n" + "
\n"); + + html_print_legend_backend (); + html_print_legend_link (); + html_print_legend_manual (); + html_print_legend_comment (); + html_print_legend_manufacturer (); + html_print_legend_model (); + html_print_legend_interface (); + html_print_legend_status (); + html_print_legend_description (); + + printf ("
\n"); html_print_footer (); } @@ -2453,48 +2198,19 @@ html_print_mfgs (void) printf ("

Legend:

\n" "
\n" - "
\n" - "
Model:
\n" - "
Name of the the device.
\n" - "
Interface:
\n" - "
How the device is connected to the computer.
\n" - "
Status:
\n"); - printf - ("
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"); - printf - ("
  • 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"); - printf - ("
Comment:
\n" - "
More information about the level of support and\n" - " possible problems.
\n" - "
Backend:
\n" - "
Name of the backend, with a link to more extensive and\n" - " detailed information, if it exists, or the email address\n" - " of the author or maintainer. In parentheses if available:\n" - " Version of backend/driver; newer versions may be\n" - " available from their home sites.
\n"); - printf - (" NEW! means brand-new to the\n" - " current release of SANE.\n" - "
\n" - "
Manual Page:
\n" - "
A link to the man-page on-line, if it exists.
\n" - "
Description:
\n" - "
The scope of application of the backend.\n" - "
\n" "
\n"); + "
\n"); + + html_print_legend_model (); + html_print_legend_interface (); + html_print_legend_status (); + html_print_legend_comment (); + html_print_legend_backend (); + html_print_legend_manual (); + + html_print_legend_manufacturer (); + html_print_legend_description (); + + printf("
\n" "\n"); html_print_footer (); } @@ -2518,9 +2234,6 @@ main (int argc, char **argv) case output_mode_ascii: ascii_print_backends (); break; - case output_mode_html_backends: - html_print_backends (); - break; case output_mode_html_backends_split: html_print_backends_split (); break;