Mercurial > octave
changeset 24370:b1d1229d9e83
maint: Use single quotes to simplify excessive backslash escapes in code.
* md5sum.m, __publish_html_output__.m, publish.m, im2double.m, zip.m,
configure_make.m, get_description.m, installed_packages.m, annotation.m,
print.m, __gnuplot_draw_axes__.m, __gnuplot_draw_figure__.m,
__gnuplot_get_var__.m, __gnuplot_ginput__.m, __gnuplot_print__.m,
__print_parse_opts__.m, struct2hdl.m, profexport.m, html_compare_plot_demos.m:
Use single quotes to simplify excessive backslash escapes in code.
line wrap: on
line diff
--- a/scripts/deprecated/md5sum.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/deprecated/md5sum.m Wed Dec 06 14:09:08 2017 -0800 @@ -25,13 +25,13 @@ ## with: ## ## @example -## hash (\"md5\", fileread (@var{file})) +## hash ("md5", fileread (@var{file})) ## @end example ## ## And calls like @code{md5sum (@var{str}, true)} with: ## ## @example -## hash (\"md5\", fileread (@var{str})) +## hash ("md5", fileread (@var{str})) ## @end example ## ## Calculate the MD5 sum of the file @var{file}.
--- a/scripts/general/private/__publish_html_output__.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/general/private/__publish_html_output__.m Wed Dec 06 14:09:08 2017 -0800 @@ -109,15 +109,15 @@ function outstr = do_header (title_str, intro_str, toc_cstr) mathjax_str = sprintf ("%s\n", -"<script type=\"text/x-mathjax-config\">", +'<script type="text/x-mathjax-config">', "MathJax.Hub.Config({", " tex2jax: { inlineMath: [['$','$'], ['\\\\(','\\\\)']] },", " TeX: { equationNumbers: { autoNumber: 'all' } }", "});", "</script>", -["<script type=\"text/javascript\" async ", ... - "src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?", ... - "config=TeX-MML-AM_CHTML\"></script>"]); +['<script type="text/javascript" async ', ... + 'src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?', ... + 'config=TeX-MML-AM_CHTML"></script>']); stylesheet_str = sprintf ("%s\n", "<style>", @@ -125,7 +125,7 @@ " max-width: 42em;", "}", "body {", -" font-family: \"Roboto Condensed\", sans-serif;", +' font-family: "Roboto Condensed", sans-serif;", " padding-left: 7.5em;", " padding-right: 7.5em;", "}", @@ -157,7 +157,7 @@ " color: Blue;", "}", "h2 {", -" font-family: \"Roboto Condensed\", serif;", +' font-family: "Roboto Condensed", serif;", " margin-top: 1.5em;", "}", "h2 a, h2 a:visited {", @@ -169,7 +169,7 @@ "<!DOCTYPE html>", "<html>", "<head>", -"<meta charset=\"UTF-8\">", +'<meta charset="UTF-8">', ["<title>" title_str "</title>"], mathjax_str, stylesheet_str, @@ -195,7 +195,7 @@ "", "<footer>", "<hr>", -["<a href=\"http://www.octave.org\">Published with GNU Octave " version() "</a>"], +['<a href="http://www.octave.org">Published with GNU Octave ' version() '</a>'], "</footer>", "<!--", "##### SOURCE BEGIN #####",
--- a/scripts/general/publish.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/general/publish.m Wed Dec 06 14:09:08 2017 -0800 @@ -1049,9 +1049,9 @@ load_snippet = ""; if (exist (context, "file") == 2) - load_snippet = sprintf ("load (\"%s\");", context); + load_snippet = sprintf ('load ("%s");', context); endif - save_snippet = sprintf ("save (\"-binary\", \"%s\");", context); + save_snippet = sprintf ('save ("-binary", "%s");', context); eval (sprintf ("function __eval__ ()\n%s\n%s\n%s\nendfunction", load_snippet, code, save_snippet));
--- a/scripts/image/im2double.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/image/im2double.m Wed Dec 06 14:09:08 2017 -0800 @@ -67,12 +67,12 @@ case "single", img = double (img); case "logical", img = double (img); case "double", # do nothing - otherwise, error ("im2double: IMG is of unsupported class \"%s\"", class (img)); + otherwise, error ('im2double: IMG is of unsupported class "%s"', class (img)); endswitch else ## indexed images if (! strcmpi (im_type, "indexed")) - error ("im2double: second input argument must be the string \"indexed\""); + error ('im2double: second input argument must be the string "indexed"'); elseif (any (isa (img, {"uint8", "uint16"}))) img = double (img) + 1; elseif (isfloat (img) || isbool (img))
--- a/scripts/miscellaneous/zip.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/miscellaneous/zip.m Wed Dec 06 14:09:08 2017 -0800 @@ -63,7 +63,7 @@ zipfile = regexprep (zipfile, "'", "\\'"); # escape single quotes cmd = sprintf ("zip -r '%s' %s", zipfile, files); if (ispc () && ! isunix ()) - cmd = strrep (cmd, "\\", "/"); + cmd = strrep (cmd, '\', '/'); endif origdir = pwd ();
--- a/scripts/pkg/private/configure_make.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/pkg/private/configure_make.m Wed Dec 06 14:09:08 2017 -0800 @@ -109,7 +109,7 @@ function [status, output] = shell (cmd, verbose) persistent have_sh; - cmd = strrep (cmd, "\\", "/"); + cmd = strrep (cmd, '\', '/'); if (ispc () && ! isunix ()) if (isempty (have_sh)) if (system ('sh.exe -c "exit"'))
--- a/scripts/pkg/private/get_description.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/pkg/private/get_description.m Wed Dec 06 14:09:08 2017 -0800 @@ -56,7 +56,7 @@ keyword, desc.name); endif if (isfield (desc, keyword)) - warning ("pkg: duplicate keyword \"%s\" in DESCRIPTION, ignoring", + warning ('pkg: duplicate keyword "%s" in DESCRIPTION, ignoring", keyword); else desc.(keyword) = value;
--- a/scripts/pkg/private/installed_packages.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/pkg/private/installed_packages.m Wed Dec 06 14:09:08 2017 -0800 @@ -59,7 +59,7 @@ ## Now check if the package is loaded. ## FIXME: Couldn't dir_in_loadpath() be used here? - tmppath = strrep (path (), "\\", "/"); + tmppath = strrep (path (), '\', '/'); for i = 1:numel (installed_pkgs_lst) if (strfind (tmppath, strrep (installed_pkgs_lst{i}.dir, '\', '/'))) installed_pkgs_lst{i}.loaded = true;
--- a/scripts/plot/appearance/annotation.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/plot/appearance/annotation.m Wed Dec 06 14:09:08 2017 -0800 @@ -1008,7 +1008,7 @@ x = [0 0 0]; y = [0 0 0]; otherwise - error ("annotation: \"%s\" headstyle not implemented", headstyle); + error ('annotation: "%s" headstyle not implemented', headstyle); endswitch R = [cos(ang) -sin(ang);
--- a/scripts/plot/util/print.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/plot/util/print.m Wed Dec 06 14:09:08 2017 -0800 @@ -678,7 +678,7 @@ endif if (pipein) if (dos_shell) - filein(filein=="'") = "\""; + filein(filein=="'") = '"'; gs_cmd = __ghostscript__ ("binary", opts.ghostscript.binary, "device", epsdevice, "source", "-", @@ -718,7 +718,7 @@ elseif (pipein && ! pipeout) if (dos_shell) ## ghostscript expects double, not single, quotes - fileout(fileout=="'") = "\""; + fileout(fileout=="'") = '"'; cmd = __ghostscript__ ("binary", opts.ghostscript.binary, "device", epsdevice, "source", "-",
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m Wed Dec 06 14:09:08 2017 -0800 @@ -147,7 +147,7 @@ colorspec = get_text_colorspec (t.color); [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", t.interpreter); fontspec = create_fontspec (f, s, gnuplot_term); - fprintf (plot_stream, "set title \"%s\" %s %s %s;\n", + fprintf (plot_stream, ['set title "%s" %s %s %s;' "\n"], undo_string_escapes (tt), fontspec, colorspec, __do_enhanced_option__ (enhanced, t)); else @@ -180,11 +180,11 @@ [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", t.interpreter); fontspec = create_fontspec (f, s, gnuplot_term); if (strcmp (axis_obj.xaxislocation, "top")) - fprintf (plot_stream, "set x2label \"%s\" %s %s %s", + fprintf (plot_stream, 'set x2label "%s" %s %s %s', undo_string_escapes (tt), colorspec, fontspec, __do_enhanced_option__ (enhanced, t)); else - fprintf (plot_stream, "set xlabel \"%s\" %s %s %s", + fprintf (plot_stream, 'set xlabel "%s" %s %s %s', undo_string_escapes (tt), colorspec, fontspec, __do_enhanced_option__ (enhanced, t)); endif @@ -208,11 +208,11 @@ [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", t.interpreter); fontspec = create_fontspec (f, s, gnuplot_term); if (strcmp (axis_obj.yaxislocation, "right")) - fprintf (plot_stream, "set y2label \"%s\" %s %s %s", + fprintf (plot_stream, 'set y2label "%s" %s %s %s', undo_string_escapes (tt), colorspec, fontspec, __do_enhanced_option__ (enhanced, t)); else - fprintf (plot_stream, "set ylabel \"%s\" %s %s %s", + fprintf (plot_stream, 'set ylabel "%s" %s %s %s', undo_string_escapes (tt), colorspec, fontspec, __do_enhanced_option__ (enhanced, t)); endif @@ -234,7 +234,7 @@ else [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", t.interpreter); fontspec = create_fontspec (f, s, gnuplot_term); - fprintf (plot_stream, "set zlabel \"%s\" %s %s %s", + fprintf (plot_stream, 'set zlabel "%s" %s %s %s', undo_string_escapes (tt), colorspec, fontspec, __do_enhanced_option__ (enhanced, t)); fprintf (plot_stream, " rotate by %f;\n", angle); @@ -604,7 +604,7 @@ imagetype = "image"; endif - titlespec{data_idx} = "title \"\""; + titlespec{data_idx} = 'title ""'; usingclause{data_idx} = sprintf ("binary array=%dx%d scan=yx origin=(%.15g,%.15g) dx=%.15g dy=%.15g using %s", x_dim, y_dim, x_origin, y_origin, dx, dy, format); withclause{data_idx} = sprintf ("with %s", imagetype); @@ -668,7 +668,7 @@ have_cdata(data_idx) = false; have_3d_patch(data_idx) = false; if (isempty (obj.displayname)) - titlespec{data_idx} = "title \"\""; + titlespec{data_idx} = 'title ""'; else tmp = undo_string_escapes ( __maybe_munge_text__ (enhanced, obj, "displayname", hlgndntrp) @@ -713,7 +713,7 @@ parametric(data_idx) = parametric(data_idx - 1); have_cdata(data_idx) = have_cdata(data_idx - 1); have_3d_patch(data_idx) = have_3d_patch(data_idx - 1); - titlespec{data_idx} = "title \"\""; + titlespec{data_idx} = 'title ""'; usingclause{data_idx} = usingclause{data_idx - 1}; data{data_idx} = data{data_idx - 1}; withclause{data_idx} = sprintf ("with %s linestyle %d", @@ -725,7 +725,7 @@ parametric(data_idx) = parametric(data_idx - 1); have_cdata(data_idx) = have_cdata(data_idx - 1); have_3d_patch(data_idx) = have_3d_patch(data_idx - 1); - titlespec{data_idx} = "title \"\""; + titlespec{data_idx} = 'title ""'; usingclause{data_idx} = usingclause{data_idx - 1}; data{data_idx} = data{data_idx - 1}; withclause{data_idx} = sprintf ("with %s linestyle %d", @@ -791,7 +791,7 @@ endif if (i > 1 || isempty (obj.displayname)) - titlespec{local_idx} = "title \"\""; + titlespec{local_idx} = 'title ""'; else tmp = undo_string_escapes ( __maybe_munge_text__ (enhanced, obj, "displayname", hlgndntrp) @@ -872,10 +872,10 @@ [zcol; zcol(end)], [ccdat; ccdat(end)]]']; else if (isscalar (obj.facealpha)) - colorspec = sprintf ("lc rgb \"#%02x%02x%02x\" fillstyle transparent solid %f", + colorspec = sprintf ('lc rgb "#%02x%02x%02x" fillstyle transparent solid %f', round (255*color), obj.facealpha); else - colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"", + colorspec = sprintf ('lc rgb "#%02x%02x%02x"', round (255*color)); endif @@ -899,7 +899,7 @@ parametric(data_idx) = false; have_cdata(data_idx) = false; have_3d_patch(data_idx) = false; - titlespec{data_idx} = "title \"\""; + titlespec{data_idx} = 'title ""'; usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata)); if (isfield (obj, "markersize")) @@ -999,7 +999,7 @@ ccol = 255*ccol*[0x1; 0x100; 0x10000]; endif else - colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"", + colorspec = sprintf ('lc rgb "#%02x%02x%02x"', uint8 (255*color)); endif @@ -1042,7 +1042,7 @@ sidx += 1; endif if (isnumeric (obj.markerfacecolor)) - colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"", + colorspec = sprintf ('lc rgb "#%02x%02x%02x"', round (255*obj.markerfacecolor)); endif style = "points"; @@ -1099,10 +1099,10 @@ if (! isempty (pt)) if (strcmp (obj.markeredgecolor, "auto")) - colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"", + colorspec = sprintf ('lc rgb "#%02x%02x%02x"', round (255*color)); elseif (isnumeric (obj.markeredgecolor)) - colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"", + colorspec = sprintf ('lc rgb "#%02x%02x%02x"', round (255*obj.markeredgecolor)); endif style = "points"; @@ -1177,7 +1177,7 @@ parametric(data_idx) = parametric(data_idx - 1); have_cdata(data_idx) = have_cdata(data_idx - 1); have_3d_patch(data_idx) = have_3d_patch(data_idx - 1); - titlespec{data_idx} = "title \"\""; + titlespec{data_idx} = 'title ""'; usingclause{data_idx} = usingclause{data_idx - 1}; data{data_idx} = data{data_idx - 1}; withclause{data_idx} = tmpwith{2}; @@ -1188,7 +1188,7 @@ parametric(data_idx) = parametric(data_idx - 1); have_cdata(data_idx) = have_cdata(data_idx - 1); have_3d_patch(data_idx) = have_3d_patch(data_idx - 1); - titlespec{data_idx} = "title \"\""; + titlespec{data_idx} = 'title ""'; usingclause{data_idx} = usingclause{data_idx - 1}; data{data_idx} = data{data_idx - 1}; withclause{data_idx} = tmpwith{3}; @@ -1212,7 +1212,7 @@ titlespec{data_idx} = ['title "' tmp '"']; data{data_idx} = NaN (3,1); usingclause{data_idx} = sprintf ("record=1 using ($1):($2):($3)"); - withclause{data_idx} = sprintf ("with line linewidth 10 linecolor rgb \"#%02x%02x%02x\"", + withclause{data_idx} = sprintf ('with line linewidth 10 linecolor rgb "#%02x%02x%02x"', round (255*cmap(end/2,:))); endif @@ -1252,7 +1252,7 @@ have_3d_patch(data_idx) = false; titlespec{data_idx} = tspec; - tspec = "title \"\""; + tspec = 'title ""'; flat_interp_face = (strcmp (obj.facecolor, "flat") || strcmp (obj.facecolor, "interp")); @@ -1632,7 +1632,7 @@ "set palette positive color model RGB maxcolors %i;\n", cmap_sz); fprintf (plot_stream, - "set palette file \"-\" binary record=%d using 1:2:3:4;\n", + ['set palette file "-" binary record=%d using 1:2:3:4;' "\n"], cmap_sz); fwrite (plot_stream, [1:cmap_sz; cmap.'], "float32"); fwrite (plot_stream, "\n"); @@ -1645,7 +1645,7 @@ ## Images can be obscured by background or foreground image if (is_image_data (i)) if (bg_is_set) - fputs (plot_stream, "if (GPVAL_TERM eq \"qt\") unset obj 1;\n"); + fputs (plot_stream, ['if (GPVAL_TERM eq "qt") unset obj 1;' "\n"]); bg_is_set = false; endif if (fg_is_set) @@ -1687,6 +1687,8 @@ endif if (have_3d_patch (1)) fputs (plot_stream, "set pm3d depthorder\n"); + ## FIXME: Must leave strings ending in '\', CHAR in double quotes. + ## Otherwise, fprintf routine tries to do escape processing and fails. fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd, usingclause{1}, titlespec{1}, withclause{1}); elseif (is_image_data (1)) @@ -1742,7 +1744,7 @@ endif if (bg_is_set) - fputs (plot_stream, "if (GPVAL_TERM eq \"qt\") unset obj 1;\n"); + fputs (plot_stream, ['if (GPVAL_TERM eq "qt") unset obj 1;' "\n"]); bg_is_set = false; endif @@ -1780,9 +1782,9 @@ function fontspec = create_fontspec (f, s, gp_term) if (isempty (f) || strcmp (f, "*") || strcmp (gp_term, "tikz")) - fontspec = sprintf ("font \",%d\"", s); + fontspec = sprintf ('font ",%d"', s); else - fontspec = sprintf ("font \"%s,%d\"", f, s); + fontspec = sprintf ('font "%s,%d"', f, s); endif endfunction @@ -1849,12 +1851,12 @@ function tick (axischar, color, tickdir, mirrorstr); if (isnumeric (color)) if (length (color) == 3) - colorspec = sprintf ("rgb \"#%02x%02x%02x\"", round (255*color)); + colorspec = sprintf ('rgb "#%02x%02x%02x"', round (255*color)); else colorspec = sprintf ("palatte %d", round (color)); endif else - colorspec = sprintf ("\"%s\"", color); + colorspec = sprintf ('"%s"', color); endif fprintf (plot_stream, "set %ctics %s %s textcolor %s\n", axischar, tickdir, mirrorstr, colorspec); @@ -1880,7 +1882,7 @@ else alphastr = ""; endif - fprintf (plot_stream, " linecolor rgb \"#%s%02x%02x%02x\"", + fprintf (plot_stream, ' linecolor rgb "#%s%02x%02x%02x"', alphastr, round (255*color)); else color = [0, 0, 0]; @@ -1943,7 +1945,7 @@ fprintf (plot_stream, "set style line %d default;\n", idx); fprintf (plot_stream, "set style line %d", idx); if (isnumeric (obj.markerfacecolor)) - fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"", + fprintf (plot_stream, ' linecolor rgb "#%02x%02x%02x"', round (255*obj.markerfacecolor)); else fprintf (plot_stream, " palette"); @@ -1990,7 +1992,7 @@ else edgecolor = obj.color; end - fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"", + fprintf (plot_stream, ' linecolor rgb "#%02x%02x%02x"', round (255*edgecolor)); else fprintf (plot_stream, " palette"); @@ -2270,7 +2272,7 @@ num_mtics = 5; endif colorspec = get_text_colorspec (color); - fprintf (plot_stream, "set format %s \"%s\";\n", ax, fmt); + fprintf (plot_stream, ['set format %s "%s";' "\n"], ax, fmt); if (strcmp (ticmode, "manual")) if (isempty (tics)) fprintf (plot_stream, "unset %stics;\nunset m%stics;\n", ax, ax); @@ -2296,7 +2298,7 @@ tickdir, ticklength, axispos, mirror); labels = strrep (labels, "%", "%%"); for i = 1:ntics - fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i)); + fprintf (plot_stream, ' "%s" %.15g', labels{k++}, tics(i)); if (i < ntics) fputs (plot_stream, ", "); endif @@ -2324,7 +2326,7 @@ endfunction function colorspec = get_text_colorspec (color) - colorspec = sprintf ("textcolor rgb \"#%02x%02x%02x\"", round (255*color)); + colorspec = sprintf ('textcolor rgb "#%02x%02x%02x"', round (255*color)); endfunction function [f, s, fnt, it, bld] = get_fontname_and_size (t) @@ -2826,7 +2828,7 @@ zstr = ""; endif fprintf (stream, - "set label \"%s\" at %s %.15e,%.15e%s %s rotate by %f offset character %f,%f %s %s front %s;\n", + ['set label "%s" at %s %.15e,%.15e%s %s rotate by %f offset character %f,%f %s %s front %s;' "\n"], undo_string_escapes (label), units, lpos(1), lpos(2), zstr, halign, angle, dx_and_dy, fontspec, __do_enhanced_option__ (enhanced, obj), colorspec);
--- a/scripts/plot/util/private/__gnuplot_draw_figure__.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/plot/util/private/__gnuplot_draw_figure__.m Wed Dec 06 14:09:08 2017 -0800 @@ -38,7 +38,7 @@ fputs (plot_stream, "set size 1, 1\n"); bg = get (h, "color"); if (isnumeric (bg)) - fprintf (plot_stream, "if (GPVAL_TERM eq \"qt\") set obj 1 rectangle from screen 0,0 to screen 1,1 behind fc rgb \"#%02x%02x%02x\" fs solid noborder;\n", round (255 * bg)); + fprintf (plot_stream, ['if (GPVAL_TERM eq "qt") set obj 1 rectangle from screen 0,0 to screen 1,1 behind fc rgb "#%02x%02x%02x" fs solid noborder;' "\n"], round (255 * bg)); bg_is_set = true; else bg_is_set = false; @@ -114,7 +114,7 @@ endif endfor if (bg_is_set) - fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", round (255 * (1 - bg))); + fprintf (plot_stream, ['set border linecolor rgb "#%02x%02x%02x"' "\n"], round (255 * (1 - bg))); endif __gnuplot_draw_axes__ (kids(i), plot_stream, enhanced, bg_is_set, false, hlgnd); @@ -140,7 +140,7 @@ set (kids(i), "units", "normalized"); fg = get (kids(i), "color"); if (isnumeric (fg) && strcmp (get (kids(i), "visible"), "on")) - fprintf (plot_stream, "set obj 2 rectangle from graph 0,0 to graph 1,1 behind fc rgb \"#%02x%02x%02x\" fs solid noborder\n", round (255 * fg)); + fprintf (plot_stream, ['set obj 2 rectangle from graph 0,0 to graph 1,1 behind fc rgb "#%02x%02x%02x" fs solid noborder' "\n"], round (255 * fg)); fg_is_set = true; fg_was_set = true; elseif (fg_was_set) @@ -151,7 +151,7 @@ fg_is_set = false; endif if (bg_is_set) - fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", round (255 * (1 - bg))); + fprintf (plot_stream, ['set border linecolor rgb "#%02x%02x%02x"' "\n"], round (255 * (1 - bg))); endif ## Find if this axes has an associated legend axes and pass it ## to __gnuplot_draw_axes__
--- a/scripts/plot/util/private/__gnuplot_get_var__.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/plot/util/private/__gnuplot_get_var__.m Wed Dec 06 14:09:08 2017 -0800 @@ -71,7 +71,7 @@ ## or Alt-F4. Further, this abrupt close also requires the leading ## "\n" on the next line. if (use_mkfifo) - fprintf (ostream, "\nset print \"%s\";\n", gpin_name); + fprintf (ostream, ["\n" 'set print "%s";' "\n"], gpin_name); fflush (ostream); [gpin, err] = fopen (gpin_name, "r"); if (err) @@ -81,7 +81,7 @@ if (err) error ("__gnuplot_get_var__: can not open FIFO"); endif - gp_cmd = sprintf ("\nif (exists(\"%s\")) print %s; else print NaN\n", + gp_cmd = sprintf (["\n" 'if (exists("%s")) print %s; else print NaN' "\n"], gp_var_name(1:n), gp_var_name); fputs (ostream, gp_cmd); @@ -103,9 +103,9 @@ fclose (gpin); else ## Direct gnuplot to print to <STDOUT> - fprintf (ostream, "set print \"-\";\n"); + fprintf (ostream, ['set print "-";' "\n"]); fflush (ostream); - gp_cmd = sprintf ("\nif (exists(\"%s\")) print \"OCTAVE: \", %s; else print NaN\n", + gp_cmd = sprintf (["\n" 'if (exists("%s")) print "OCTAVE: ", %s; else print NaN' "\n"], gp_var_name(1:n), gp_var_name); fputs (ostream, gp_cmd); fflush (ostream);
--- a/scripts/plot/util/private/__gnuplot_ginput__.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/plot/util/private/__gnuplot_ginput__.m Wed Dec 06 14:09:08 2017 -0800 @@ -80,14 +80,14 @@ ## or Alt-F4. Further, this abrupt close also requires the leading ## "\n" on the next line. if (use_mkfifo) - fprintf (ostream, "set print \"%s\";\n", gpin_name); + fprintf (ostream, ['set print "%s";' "\n"], gpin_name); fflush (ostream); [gpin, err] = fopen (gpin_name, "r"); if (err) error ("ginput: Can not open FIFO (%s)", msg); endif fputs (ostream, "pause mouse any;\n\n"); - fputs (ostream, "\nif (exists(\"MOUSE_KEY\") && exists(\"MOUSE_X\")) print MOUSE_X, MOUSE_Y, MOUSE_KEY; else print \"0 0 -1\"\n"); + fputs (ostream, ["\n" 'if (exists("MOUSE_KEY") && exists("MOUSE_X")) print MOUSE_X, MOUSE_Y, MOUSE_KEY; else print "0 0 -1"' "\n"]); ## Close output file, to force it to be flushed fputs (ostream, "set print;\n"); @@ -97,10 +97,10 @@ [x(k), y(k), button(k), count] = fscanf (gpin, "%f %f %d", "C"); fclose (gpin); else - fputs (ostream, "set print \"-\";\n"); + fputs (ostream, ['set print "-";' "\n"]); fflush (ostream); fputs (ostream, "pause mouse any;\n\n"); - fputs (ostream, "\nif (exists(\"MOUSE_KEY\") && exists(\"MOUSE_X\")) key = (MOUSE_KEY==1063 ? 1 : MOUSE_KEY); print \"OCTAVE: \", MOUSE_X, MOUSE_Y, key; else print \"0 0 -1\"\n"); + fputs (ostream, ["\n" 'if (exists("MOUSE_KEY") && exists("MOUSE_X")) key = (MOUSE_KEY==1063 ? 1 : MOUSE_KEY); print "OCTAVE: ", MOUSE_X, MOUSE_Y, key; else print "0 0 -1"' "\n"]); ## Close output file, to force it to be flushed fputs (ostream, "set print;\n");
--- a/scripts/plot/util/private/__gnuplot_print__.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/plot/util/private/__gnuplot_print__.m Wed Dec 06 14:09:08 2017 -0800 @@ -47,7 +47,7 @@ gp_opts = font_spec (opts); bg = get (opts.figure, "color"); if (isnumeric (bg)) - gp_opts = sprintf ("%s background rgb \"#%02x%02x%02x\"", + gp_opts = sprintf ('%s background rgb "#%02x%02x%02x"', gp_opts, round (255 * bg)); else gp_opts = sprintf ("%s nobackground", gp_opts);
--- a/scripts/plot/util/private/__print_parse_opts__.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/plot/util/private/__print_parse_opts__.m Wed Dec 06 14:09:08 2017 -0800 @@ -444,7 +444,7 @@ if (! is_quoted) dos_shell = ! isunix () && ispc (); if (dos_shell && any (cmd == "/")) - cmd = strrep (cmd, "/", "\\"); + cmd = strrep (cmd, '/', '\'); endif if (any (cmd == " ")) cmd = ['"' strrep(cmd, '"', '""') '"'];
--- a/scripts/plot/util/struct2hdl.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/plot/util/struct2hdl.m Wed Dec 06 14:09:08 2017 -0800 @@ -68,12 +68,12 @@ ## create appropriate parent if needed if (any (strcmp (s.type, othertypes))) for ii = (paridx+1) : (numel (partypes)-1) - eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]); + eval (["hpar = " partypes{ii} '("parent", hpar);']); p = [p [NaN; hpar]]; endfor elseif (any (strcmp (s.type, {"hggroup", "axes"}))) for ii = (paridx+1) : (kididx-1) - eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]); + eval (["hpar = " partypes{ii} '("parent", hpar);']); p = [p [NaN; hpar]]; endfor else
--- a/scripts/profiler/profexport.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/profiler/profexport.m Wed Dec 06 14:09:08 2017 -0800 @@ -290,10 +290,10 @@ endfunction function str = __escapeHtml (str) - str = strrep (str, "&", "&"); - str = strrep (str, "<", "<"); - str = strrep (str, ">", ">"); - str = strrep (str, "\"", """); + str = strrep (str, '&', "&"); + str = strrep (str, '<', "<"); + str = strrep (str, '>', ">"); + str = strrep (str, '"', """); endfunction ################################################################################
--- a/scripts/testfun/private/html_compare_plot_demos.m Wed Dec 06 13:19:15 2017 -0800 +++ b/scripts/testfun/private/html_compare_plot_demos.m Wed Dec 06 14:09:08 2017 -0800 @@ -101,14 +101,14 @@ ## Create page previous/next if (page > 1) - prev_page_link = sprintf ("<p><a href=\"%s\">%s</a></p>\n", ... + prev_page_link = sprintf (['<p><a href="%s">%s</a></p>' "\n"], ... in.output_fmt (page - 1), "previous page"); else prev_page_link = ""; endif if (! last_page) - next_page_link = sprintf ("<p><a href=\"%s\">%s</a></p>\n", ... + next_page_link = sprintf (['<p><a href="%s">%s</a></p>' "\n"], ... in.output_fmt (page + 1), "next page"); else next_page_link = ""; @@ -124,20 +124,20 @@ if (isfield (in, toolkits{t})) column_header = [column_header, in.(toolkits{t})]; endif - fprintf (fid, "<th>%s <a href=\"%s/diary.log\">diary</a></th>\n", ... + fprintf (fid, ['<th>%s <a href="%s/diary.log">diary</a></th>' "\n"], column_header, toolkits{t}); endfor fprintf (fid, "</tr>\n"); for m = start_fig:stop_fig [~, file] = fileparts (in.figfiles{m}); fn = [file "." in.fmt]; - fprintf (fid, "<tr id=\"%s\">\n", file); + fprintf (fid, ['<tr id="%s">' "\n"], file); for k = toolkits ffn = fullfile (k{:}, fn); fprintf (fid, "<td><span>%s</span><br>", ffn); if (exist (ffn, "file")) fprintf (fid, ... - "<img alt=\"%s\" src=\"%s\" style=\"width:%dpx\">", ... + '<img alt="%s" src="%s" style="width:%dpx">', ... file, ffn, in.column_width); else err_fn = strrep (ffn, ".png", ".err");