annotate scripts/plot/util/gnuplot_binary.in.m @ 31212:55415fa6a20f

svgconvert: Use Lossless encoding of images when available (bug #52193) * acinclude.m4: Check that QPainter::LosslessImageRendering flag is available. * octave-svgconvert.cc (draw): Use new flag if available. * print.m (doc): Update word of caution about svgconvert and images.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Mon, 29 Aug 2022 16:36:34 +0200
parents 796f54d4ddbf
children 597f3ee61a48
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: 29358
diff changeset
3 ## Copyright (C) 2008-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27898
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/>.
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
7 ##
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
8 ## This file is part of Octave.
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
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: 23220
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: 22681
diff changeset
13 ## (at your option) any later version.
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
14 ##
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22681
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22681
diff changeset
18 ## GNU General Public License for more details.
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
19 ##
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
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: 23220
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 ########################################################################
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
25
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
26 ## -*- texinfo -*-
21319
8880d93010d8 Remove further uses of CLASS field in @deftypefn macro.
Rik <rik@octave.org>
parents: 20173
diff changeset
27 ## @deftypefn {} {[@var{prog}, @var{args}] =} gnuplot_binary ()
22681
cef19bf07f26 gnuplot_binary.in.m: Overhaul function.
Rik <rik@octave.org>
parents: 22427
diff changeset
28 ## @deftypefnx {} {[@var{old_prog}, @var{old_args}] =} gnuplot_binary (@var{new_prog})
21319
8880d93010d8 Remove further uses of CLASS field in @deftypefn macro.
Rik <rik@octave.org>
parents: 20173
diff changeset
29 ## @deftypefnx {} {[@var{old_prog}, @var{old_args}] =} gnuplot_binary (@var{new_prog}, @var{arg1}, @dots{})
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
30 ## Query or set the name of the program invoked by the plot command when the
21319
8880d93010d8 Remove further uses of CLASS field in @deftypefn macro.
Rik <rik@octave.org>
parents: 20173
diff changeset
31 ## graphics toolkit is set to @qcode{"gnuplot"}.
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
32 ##
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
33 ## Additional arguments to pass to the external plotting program may also be
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
34 ## given. The default value is @qcode{"gnuplot"} with no additional arguments.
12215
4ae2a74ed04c Add fltk_gui_mode, fltk_mouse_wheel_zoom to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11563
diff changeset
35 ## @xref{Installation}.
16108
3cce6b4e0f7c Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents: 14138
diff changeset
36 ## @seealso{graphics_toolkit}
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
37 ## @end deftypefn
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
38
9461
ff8d7f3ad203 gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents: 7361
diff changeset
39 function [prog, args] = gnuplot_binary (new_prog, varargin)
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
40
22681
cef19bf07f26 gnuplot_binary.in.m: Overhaul function.
Rik <rik@octave.org>
parents: 22427
diff changeset
41 mlock ();
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
42 persistent gp_binary = %OCTAVE_CONF_GNUPLOT%;
9461
ff8d7f3ad203 gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents: 7361
diff changeset
43 persistent gp_args = {};
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
44
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
45 if (nargout > 0 || nargin == 0)
9461
ff8d7f3ad203 gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents: 7361
diff changeset
46 prog = gp_binary;
ff8d7f3ad203 gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents: 7361
diff changeset
47 args = gp_args;
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
48 endif
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
49
22681
cef19bf07f26 gnuplot_binary.in.m: Overhaul function.
Rik <rik@octave.org>
parents: 22427
diff changeset
50 if (nargin > 0)
16108
3cce6b4e0f7c Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents: 14138
diff changeset
51 if (! ischar (new_prog) || isempty (new_prog))
3cce6b4e0f7c Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents: 14138
diff changeset
52 error ("gnuplot_binary: NEW_PROG must be a non-empty string");
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
53 endif
16108
3cce6b4e0f7c Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents: 14138
diff changeset
54 gp_binary = new_prog;
22681
cef19bf07f26 gnuplot_binary.in.m: Overhaul function.
Rik <rik@octave.org>
parents: 22427
diff changeset
55 gp_args = {};
9461
ff8d7f3ad203 gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents: 7361
diff changeset
56 endif
ff8d7f3ad203 gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents: 7361
diff changeset
57
ff8d7f3ad203 gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents: 7361
diff changeset
58 if (nargin > 1)
16108
3cce6b4e0f7c Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents: 14138
diff changeset
59 if (! iscellstr (varargin))
3cce6b4e0f7c Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents: 14138
diff changeset
60 error ("gnuplot_binary: arguments must be character strings");
9461
ff8d7f3ad203 gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents: 7361
diff changeset
61 endif
16108
3cce6b4e0f7c Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents: 14138
diff changeset
62 gp_args = varargin;
7361
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
63 endif
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
64
a2870fd8ac58 [project @ 2008-01-12 07:50:54 by jwe]
jwe
parents:
diff changeset
65 endfunction
16108
3cce6b4e0f7c Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents: 14138
diff changeset
66
3cce6b4e0f7c Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents: 14138
diff changeset
67
3cce6b4e0f7c Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents: 14138
diff changeset
68 %!test
26074
1861e2ea0a4b gnuplot_binary: use unwind_protect instead of try/catch (bug #55023)
Carnë Draug <carandraug@octave.org>
parents: 26071
diff changeset
69 %! [orig_val, orig_args] = gnuplot_binary ();
1861e2ea0a4b gnuplot_binary: use unwind_protect instead of try/catch (bug #55023)
Carnë Draug <carandraug@octave.org>
parents: 26071
diff changeset
70 %! unwind_protect
26071
658153e1976d Fix failing BIST tests and oddities when gnuplot is not present (bug #55023).
Rik <rik@octave.org>
parents: 25054
diff changeset
71 %! [old_val, old_args] = gnuplot_binary ("__foobar__", "-opt1");
658153e1976d Fix failing BIST tests and oddities when gnuplot is not present (bug #55023).
Rik <rik@octave.org>
parents: 25054
diff changeset
72 %! assert (orig_val, old_val);
658153e1976d Fix failing BIST tests and oddities when gnuplot is not present (bug #55023).
Rik <rik@octave.org>
parents: 25054
diff changeset
73 %! assert (orig_args, old_args);
658153e1976d Fix failing BIST tests and oddities when gnuplot is not present (bug #55023).
Rik <rik@octave.org>
parents: 25054
diff changeset
74 %! assert (gnuplot_binary (), "__foobar__");
658153e1976d Fix failing BIST tests and oddities when gnuplot is not present (bug #55023).
Rik <rik@octave.org>
parents: 25054
diff changeset
75 %! [~, new_args] = gnuplot_binary ();
658153e1976d Fix failing BIST tests and oddities when gnuplot is not present (bug #55023).
Rik <rik@octave.org>
parents: 25054
diff changeset
76 %! assert (new_args, {"-opt1"});
26074
1861e2ea0a4b gnuplot_binary: use unwind_protect instead of try/catch (bug #55023)
Carnë Draug <carandraug@octave.org>
parents: 26071
diff changeset
77 %! unwind_protect_cleanup
26071
658153e1976d Fix failing BIST tests and oddities when gnuplot is not present (bug #55023).
Rik <rik@octave.org>
parents: 25054
diff changeset
78 %! gnuplot_binary (orig_val, orig_args{:});
26074
1861e2ea0a4b gnuplot_binary: use unwind_protect instead of try/catch (bug #55023)
Carnë Draug <carandraug@octave.org>
parents: 26071
diff changeset
79 %! end_unwind_protect
1861e2ea0a4b gnuplot_binary: use unwind_protect instead of try/catch (bug #55023)
Carnë Draug <carandraug@octave.org>
parents: 26071
diff changeset
80 %! assert (gnuplot_binary (), orig_val);