annotate scripts/testfun/private/html_compare_plot_demos.m @ 30564:796f54d4ddbf stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021. In all .txi and .texi files except gpl.txi and gpl.texi in the doc/liboctave and doc/interpreter directories, change the copyright to "Octave Project Developers", the same as used for other source files. Update copyright notices for 2022 (not done since 2019). For gpl.txi and gpl.texi, change the copyright notice to be "Free Software Foundation, Inc." and leave the date at 2007 only because this file only contains the text of the GPL, not anything created by the Octave Project Developers. Add Paul Thomas to contributors.in.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:22:40 -0500
parents 7854d5752dd2
children a3d8915b9f87
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
3 ## Copyright (C) 2010-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
7 ##
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
8 ## This file is part of Octave.
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24370
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24370
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## (at your option) any later version.
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
14 ##
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
18 ## GNU General Public License for more details.
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
19 ##
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24370
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
25
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20778
diff changeset
27 ## @deftypefn {} {} html_compare (@var{toolkits})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20778
diff changeset
28 ## @deftypefnx {} {} html_compare (@var{toolkits}, @var{name}, @var{value}, @dots{})
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
29 ##
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
30 ## Produces an html document to compare the plot demos produced by
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
31 ## @var{toolkits}.
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
32 ##
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
33 ## Valid property names, and their defaults, are:
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
34 ##
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
35 ## @table @samp
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
36 ## @item fmt
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
37 ## @code{"png"}
19152
0f9c5a15c8fa doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents: 18925
diff changeset
38 ##
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
39 ## @item output
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
40 ## @code{"compare_plot_demos.html"}
19152
0f9c5a15c8fa doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents: 18925
diff changeset
41 ##
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
42 ## @item template
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
43 ## @code{"html_plot_demos_template.html"}
19152
0f9c5a15c8fa doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents: 18925
diff changeset
44 ##
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
45 ## @item column_width
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
46 ## @code{600}
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
47 ## @end table
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
48 ##
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
49 ## The template parameter refers to a specially formatted html file
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
50 ## which accompanies this m-file script.
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
51 ##
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
52 ## Additional toolkit description can be added to the column header
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
53 ## with a parameter named equal to the toolkit. For example:
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
54 ##
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19152
diff changeset
55 ## @smallexample
26342
050ec530e6e4 html_compare_plot_demos.m: Fix texinfo syntax
Andreas Weber <octave@josoansi.de>
parents: 25760
diff changeset
56 ## @code{html_compare_plot_demos (@{"gnuplot", "fltk"@}, "gnuplot", " 4.6 patchlevel 5")}
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19152
diff changeset
57 ## @end smallexample
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
58 ##
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
59 ## @seealso{compare_plot_demos, dump_demos, demo}
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
60 ## @end deftypefn
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
61
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
62 function html_compare_plot_demos (toolkits, varargin)
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
63
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
64 ## Set defaults
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
65 in.fmt = "png";
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
66 in.figfiles = {};
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
67 in.output_fmt = @(p) sprintf ("compare_plot_demos_%02i.html", p);
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
68 in.template = "html_plot_demos_template.html";
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
69 in.column_width = 600;
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
70 in.plots_per_page = 50;
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
71
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
72 ## Parse inputs
28912
0de38a6ef693 maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents: 27978
diff changeset
73 for n = 1:2:numel (varargin)
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
74 in.(lower(varargin{n})) = varargin{n+1};
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
75 endfor
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
76
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
77 ## Compile a list of all files for all toolkits
28912
0de38a6ef693 maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents: 27978
diff changeset
78 for t = 1:numel (toolkits)
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
79 filter = sprintf ("%s/*.%s", toolkits{t}, in.fmt);
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
80 in.figfiles = union (in.figfiles, {dir(filter).name});
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
81 endfor
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
82
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
83 fid = fopen (which (in.template), "r");
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
84 template = char (fread (fid)) .';
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
85 fclose (fid);
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
86
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
87 anchor = "<!-- ##ADD TABLE HERE## -->";
25760
2ccad4396afc findstr.m: Make m-file a legacy function.
Rik <rik@octave.org>
parents: 25054
diff changeset
88 n = strfind (template, anchor);
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
89 header = strtrim (template(1:n-1));
28912
0de38a6ef693 maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents: 27978
diff changeset
90 trailer = strtrim (template(n+numel (anchor):end));
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
91
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
92 page = 1;
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
93 do
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
94 start_fig = (page - 1) * in.plots_per_page + 1;
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
95 stop_fig = page * in.plots_per_page;
23032
f2456a17490c compare_plot_demos: fix spurious link to next page
Mike Miller <mtmiller@octave.org>
parents: 23031
diff changeset
96 last_page = stop_fig >= numel (in.figfiles);
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
97 if (last_page)
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
98 stop_fig = numel (in.figfiles);
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
99 endif
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
100
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
101 fid = fopen (in.output_fmt (page), "w");
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
102 unwind_protect
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
103 fprintf (fid, "%s\n", header);
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
104 fprintf (fid, "<h2>Generated on %s by %s with GNU Octave %s</h2>\n", ...
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
105 datestr (now (), 0), mfilename, version);
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
106
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
107 ## Create page previous/next
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
108 if (page > 1)
24370
b1d1229d9e83 maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents: 23220
diff changeset
109 prev_page_link = sprintf (['<p><a href="%s">%s</a></p>' "\n"], ...
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
110 in.output_fmt (page - 1), "previous page");
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
111 else
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
112 prev_page_link = "";
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
113 endif
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
114
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
115 if (! last_page)
24370
b1d1229d9e83 maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents: 23220
diff changeset
116 next_page_link = sprintf (['<p><a href="%s">%s</a></p>' "\n"], ...
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
117 in.output_fmt (page + 1), "next page");
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
118 else
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
119 next_page_link = "";
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
120 endif
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
121
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
122 fprintf (fid, "%s%s", prev_page_link, next_page_link);
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
123
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
124 ## Create table header
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
125 fprintf (fid, "<table>\n<tr>\n");
28912
0de38a6ef693 maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents: 27978
diff changeset
126 for t = 1:numel (toolkits)
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
127 ## set default
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
128 column_header = upper (toolkits{t});
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
129 if (isfield (in, toolkits{t}))
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
130 column_header = [column_header, in.(toolkits{t})];
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
131 endif
24370
b1d1229d9e83 maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents: 23220
diff changeset
132 fprintf (fid, ['<th>%s <a href="%s/diary.log">diary</a></th>' "\n"],
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
133 column_header, toolkits{t});
18925
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
134 endfor
87324260043d Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18877
diff changeset
135 fprintf (fid, "</tr>\n");
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
136 for m = start_fig:stop_fig
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
137 [~, file] = fileparts (in.figfiles{m});
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
138 fn = [file "." in.fmt];
24370
b1d1229d9e83 maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents: 23220
diff changeset
139 fprintf (fid, ['<tr id="%s">' "\n"], file);
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
140 for k = toolkits
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
141 ffn = fullfile (k{:}, fn);
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
142 fprintf (fid, "<td><span>%s</span><br>", ffn);
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
143 if (exist (ffn, "file"))
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
144 fprintf (fid, ...
24370
b1d1229d9e83 maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents: 23220
diff changeset
145 '<img alt="%s" src="%s" style="width:%dpx">', ...
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
146 file, ffn, in.column_width);
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
147 else
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
148 err_fn = strrep (ffn, ".png", ".err");
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
149 if (! exist (err_fn, "file"))
28912
0de38a6ef693 maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents: 27978
diff changeset
150 warning ("File %s doesn't exist...", err_fn);
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
151 else
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
152 err_fid = fopen (err_fn);
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
153 msg = char (fread (err_fid))';
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
154 fclose (err_fid);
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
155 fprintf (fid, "<span>%s</span>", strrep (msg, "\n", "<br>"));
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
156 endif
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
157 endif
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
158 fprintf (fid, "</td>\n");
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
159 endfor
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
160 fprintf (fid, "</tr>\n");
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
161 endfor
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
162
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
163 fprintf (fid, "</table>\n");
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
164 fprintf (fid, "%s%s", prev_page_link, next_page_link);
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
165
23031
fdf9f98c3b72 compare_plot_demos: fix HTML syntax, simplify output, remove external deps (bug #49709)
Mike Miller <mtmiller@octave.org>
parents: 22323
diff changeset
166 fprintf (fid, "%s\n", trailer);
22126
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
167 page++;
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
168 unwind_protect_cleanup
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
169 fclose (fid);
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
170 end_unwind_protect
3f8ed6d7cb1c Improve plot comparison in sripts/testfun
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20852
diff changeset
171 until (stop_fig == numel (in.figfiles))
18874
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
172
c74673161752 Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
173 endfunction