From 1c356bb6c164f00354cd70ec73657fcac7273e2f Mon Sep 17 00:00:00 2001 From: Stefan Tauner Date: Thu, 11 Jul 2013 13:48:52 +0000 Subject: print_wiki: Fixes, explanation re Flash chips, links to footnotes. - Escape mainboard notes in the wiki output with (this became necessary because MediaWiki started to convert to ). - Add explanations at the top of the flash chip table in the wiki. - Add links to the footnotes of mainboards and laptops similarly to what MediaWiki does: link from the reference to the footnote and vice versa too. Also, check for truncations of the footnotes due to the limited buffer. - Fix a typo introduced in r1555. Corresponding to flashrom svn r1694. Signed-off-by: Stefan Tauner Acked-by: Stefan Tauner --- print_wiki.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'print_wiki.c') diff --git a/print_wiki.c b/print_wiki.c index bd9d9f7..5dcc4b6 100644 --- a/print_wiki.c +++ b/print_wiki.c @@ -76,6 +76,18 @@ static const char chip_th[] = "\ | Probe\n| Read\n| Erase\n| Write\n\ | align=\"center\" | Min \n| align=\"center\" | Max\n\n"; +static const char chip_intro[] = "\ +\n== Supported flash chips ==\n\n\ +The list below contains all chips that have some kind of explicit support added to flashrom and their last \ +known test status. Newer SPI flash chips might work even without explicit support if they implement SFDP ([\ +http://www.jedec.org/standards-documents/docs/jesd216 Serial Flash Discoverable Parameters - JESD216]). \ +Flashrom will detect this automatically and inform you about it.\n\n\ +The names used below are designed to be as concise as possible and hence contain only the characters \ +describing properties that are relevant to flashrom. Irrelevant characters specify attributes flashrom can not \ +use or even detect by itself (e.g. the physical package) and have no effect on flashrom's operation. They are \ +replaced by dots ('.') functioning as wildcards (like in Regular Expressions) or are completely omitted at the \ +end of a name.\n"; + static const char programmer_th[] = "\ ! align=\"left\" | Programmer\n\ ! align=\"left\" | Vendor\n\ @@ -159,7 +171,7 @@ static void print_supported_boards_wiki_helper(const char *devicetype, int cols, /* +1 to force the resulting number of columns to be < cols */ lines_per_col = boardcount / cols + ((boardcount%cols) > 0 ? 1 : 0); - printf("\n\nTotal amount of known good boards %s: '''%d'''; " + printf("\n\nTotal amount of known good %s: '''%d'''; " "Untested (e.g. user vanished before testing new code): '''%d'''; " "Not yet supported (i.e. known-bad): '''%d'''.\n\n" "{| border=\"0\" valign=\"top\"\n", devicetype, boardcount_good, boardcount_nt, boardcount_bad); @@ -194,9 +206,17 @@ static void print_supported_boards_wiki_helper(const char *devicetype, int cols, (boards[i].working == NT) ? "?3" : "No"); if (boards[i].note) { - printf("%d\n", num_notes + 1); - snprintf(tmp, sizeof(tmp), "%d %s
\n", - 1 + num_notes++, boards[i].note); + num_notes++; + printf(" [[#%s_note%d|%d]]\n", + devicetype, num_notes, devicetype, num_notes, num_notes); + int ret = snprintf(tmp, sizeof(tmp), + "%d. [[#%s_ref%d|↑]]" + " %s
\n", devicetype, num_notes, num_notes, + devicetype, num_notes, boards[i].note); + if (ret < 0 || ret >= sizeof(tmp)) { + fprintf(stderr, "Footnote text #%d of %s truncated (ret=%d, sizeof(tmp)=%zu)\n", + num_notes, devicetype, ret, sizeof(tmp)); + } notes = strcat_realloc(notes, tmp); } else { printf("\n"); @@ -248,7 +268,8 @@ static void print_supported_chips_wiki(int cols) /* +1 to force the resulting number of columns to be < cols */ lines_per_col = chipcount / cols + ((chipcount%cols) > 0 ? 1 : 0); - printf("\n== Supported chips ==\n\nTotal amount of supported chips: '''%d'''\n\n" + printf("%s", chip_intro); + printf("\nTotal amount of supported chips: '''%d'''\n\n" "{| border=\"0\" valign=\"top\"\n", chipcount); for (f = flashchips; f->name != NULL; f++) { -- cgit v1.1